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 -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -