regex - Exclude expressin '?!' cannot be validated -
in xsd schema, there 1 particular regex <xs:pattern value="(?!tr)[a-z]{2}"/>
pattern causes error. want ignore 'tr' , match other country codes. although regular expression works fine in several online editors, eclipse says:
invalidregex: pattern value '(?!tr)[a-z]{2}' not valid regular expression. reported error was: 'this expression not supported in current option setting.'
despite it's simple expression, cannot figure out why cannot validated. error, cannot deploy xsd file service bus. there problem aclipse or sth else?
all advises appreciated!
xml schema regex flavor not support lookarounds. non-lookaround version of regex is
[a-su-z][a-z]|[a-z][a-qs-z]
or, using character class subtraction:
[a-z-[t]][a-z]|[a-z][a-z-[r]]
see regex demo
just note used ^
, $
in demo because flavor pcre there. in xsd pattern
, regex anchored default, no ^
, $
necessary.
pattern details:
[a-su-z]
(or [a-z-[t]])- uppercase ascii letter other than
t`[a-z]
- uppercase ascii letter|
- or[a-z]
- uppercase ascii letter[a-qs-z]
(or[a-z-[r]]
) - uppercase ascii letter otherr
Comments
Post a Comment