Apache Struts 2 Documentation > Home > Guides > Core Developers Guide > Validation > regex validator |
Validates a string field using a regular expression.
true
.<validators> <!-- Plain Validator Syntax --> <validator type="regex"> <param name="fieldName">myStrangePostcode</param> <param name="expression"><![CDATA[([aAbBcCdD][123][eEfFgG][456])]]<>/param> </validator> <!-- Field Validator Syntax --> <field name="myStrangePostcode"> <field-validator type="regex"> <param name="expression"><![CDATA[([aAbBcCdD][123][eEfFgG][456])]]></param> </field-validator> </field> </validators>