javascript - How to ignore certain characters in regular expression? -


i have regex pattern working in javascript. problem don't want pick '|' or '&' characters. here have @ moment.

/^!?[^:(){},'[]+-]+$|[a-za-z0-9-_]+/ 

can tell me need stop regex picking these 2 characters part of this? thanks!

you can use negative lookahead avoid matching these characters in input:

/^(?![^|&]*[|&])!?[^:(){},'[]+-]+$|[a-za-z0-9-_]+/ 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -