validator-rules.xml で、正規表現チェック("mask")を定義する時に、正規表現の内容に名前を付けておくことができる。
<form-validation> <global> <constant> <constant-name>phone</constant-name> <constant-value>^\(?(\d{3})\)?[-| ]?(\d{3})[-| ]?(\d{4})$</constant-value> </constant> </global> <formset> <constant> <constant-name>zip</constant-name> <constant-value>^\d{5}(-\d{4})?$</constant-value> </constant> <form name="registrationForm"> <field property="name" depends="required,mask"> <arg key="registrationForm.name" /> <var> <var-name>mask</var-name> <var-value>[a-zA-Z]+</var-value> </var> </field> <field property="zipPostal" depends="required,mask"> <arg key="registrationForm.zipPostal" /> <var> <var-name>mask</var-name> <var-value>${zip}</var-value> </var> </field> <field property="phone" depends="mask"> <arg key="registrationForm.phone" /> <var> <var-name>mask</var-name> <var-value>${phone}</var-value> </var> </field> </form> </formset> </form-validation>