RegExp \ W metacharacter
Definition and Usage
\ W metacharacter is used to find a non-word character.
Word characters include: az, AZ, 0-9, and the underscore.
grammar
new RegExp("\W")
或者更简单方式:
/\W/
或者更简单方式:
/\W/
Browser Support
All major browsers support \ W metacharacter
Examples
Examples
For non-word character string global search:
var str="Give 100%!";
var patt1=/\W/g;
var patt1=/\W/g;
The marked text below shows where the expression gets a match:
Give 100 %!
try it"
JavaScript RegExp Object