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

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -