tags:

views:

206

answers:

1

Hello,

I am parsing a XML file against a XSD containing some regex patterns used for checking input data, but only this regex generates an error, even if it passes into the Eclipse XSD plugin:

   InvalidRegex: Pattern value 
   '(((com|org)\.)+(\b[a-z]+[.]{1}\b)+)?[A-Z]{1}[A-Za-z]+' 
   is not a valid regular expression. The reported error was: 
   'This expression is not supported in the current option setting.'.

So even if the problem is caused by the \b boundary which I can safely remove, with SAX validator where can I find the fatal "current option setting"?

+1  A: 

\b is not supported by the XML Schema regex flavor as specified by the W3C. The error message implies that you can use it anyway by changing a setting, but then you would be using a non-standard feature, which would defeat the purpose of using XML.

I'm not sure that's what the error message really means, but it would have been more helpful if it had just the regex was invalid. Do yourself a favor and forget about using \b in your XSD's. And check out the rest of the regular-expressions.info site if you haven't already--it's a great resource.

Alan Moore