I have a problem with negative lookahead in XSD pattern. When I specified:
<xs:pattern value="^(?!(00|\+\d))\d{6,}$"/>
then I got an error message:
Value '^(?!(00|\+\d))\d{6,}$' is not a valid XML regular expression.
Any idea why it does not work?
In online javascript validator it works fine (e.g. here under unit tests section click on "run test").
I need to validate phone numbers. The phone number cannot include international prefixes (+\d) and (00).
Thanks
Try the following regex:
[1-9][0-9]{5,} | 0[1-9][0-9]{4,}
This matches a number which does not begin with zero and is followed by any digit (including zero) 5 or more times, and it also matches a number which starts with zero and is not immediately followed by zero, but after that can have 0-9.
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