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
Post a Comment