java - REGEX Expression to exclude toll-free numbers -


i have regex expression written should extract toll-free numbers when there number 1-800-343-2432 (when there 1 before 800 stuff) doesn't work

(?!(\$|#|800|855|866|877|888))\(?[\\s.-]*([0-9]{3})?[\\s.-]*\)?[\\s.-]*[0-9]{3}[\\s.-]*[0-9]{4} 

how can modify expression not take numbers 1-866-343-1232 ?!

without checking full regex can use regex block 1-888:

(?!(?:1-)?(\\$|#|800|855|866|877|888))\(?[\\s.-]*([0-9]{3})?[\\s.-]*\)?[\\s.-]*[0-9]{3}[\\s.-]*[0-9]{4} 

Comments

Popular posts from this blog

android - Automated my builds -

python - How to return the most similar word from a list of words? -

apache - GeoServer under https -