"^\w{2}-\w{6}(-\w{2}){0,5}$ | ^[0-9]{4,6}$" "^\\w{2}-\\w{6}(-\\w{2}){0,5}|([0-9]{4,6})$";
Are different.... you are missing the ^ sign after the | operator... Please read the regular expression book properly ...... -----Original Message----- From: Ferruh Zamangör [mailto:[EMAIL PROTECTED] Sent: 23 April 2007 13:17 To: user@struts.apache.org Subject: Struts Validation Problems Hi, I have some problems with using the following regular expression in the validation framework from Struts. <field property="projectNumber" depends="required,mask"> <msg name="mask" key="errors.format"/> <arg key="projectNumber" /> <arg key="GB-XXXXXX-AA-BB-CC-DD-EE" resource="false" position="1"/> <var> <var-name>mask</var-name> <var-value>^\w{2}-\w{6}(-\w{2}){0,5}$ | ^[0-9]{4,6}$</var-value> </var> </field> I have tested with the following scenarios: 333 ==> validation works and a validation message is displayed. 6666 ==> validation OK 1234567 ==> validation does not work, no validation error is displayed When I use the same pattern in a java class it works fine??? String input = "1234567"; String pattern = "^\\w{2}-\\w{6}(-\\w{2}){0,5}|([0-9]{4,6})$"; Pattern p = Pattern.compile(pattern); Matcher match = p.matcher(input); boolean result = match.matches(); Can anybody tell me what is wrong in the above definition of the field ?? Regards Ferruh --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]