javascript - Negation of regular expression -


i have regular expression:

var regex = /^[-.:_a-za-z0-9]*/; 

but need test string see if has characters not match expression.

i have tried

var regex =/^[^-.:_a-za-z0-9]*$/; 

but did not catch characters looking for.

basically, need regular expression can use in javascript find character not - . : . a-z a-z or 0-9 in javascript string variable.

thisshouldpass

thisshou[][]ldfail

i suspect want remove anchors , *:

var regex =/[^-.:_a-za-z0-9]/; 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -