currently I'm trying to find a regular expression with the following condition:
Match: FOO_.* (valid if the string contains FOO_ at the beginning)
Don't Match: FOO_BAR (not valid if the string contains BAR)
Usually I would use the following expression:
FOO_(?!BAR)
My problem with that solution is, that I want to use it in a xml schema. Using it with a parsers brings up the following error message:
schema.xsd:50: element pattern: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}pattern': The value 'FOO_(?!BAR)' of the facet 'pattern' is not a valid regular expression.
WXS schema schema.xsd failed to compile
Is there a readable ;-) working solution or is it just not possible inside a xml schema?
The Lookaround part (?!BAR)
of your expression is not supported in XML schema.
For your specific example the following expression should give you an idea how you could workaround this limitation:
FOO_([^B].*|B([^A].*|A([^R].*)?)?)?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With