Latest

recent

JavaScript RegExp \W Modifier

Definition and Usage

When the \W modifier is set the regular expression finds any non alphanumeric (not a-z, A-Z, 0-9 or  _ ) character.

Syntax

/\W/


Example

In the following code we will do a global search for the all non alphanumeric characters:

var str = "Give 100%!!!";
var patt1 = /\W/g;

The marked text below shows where the RegExp gets a match:

Give 100%!!!
JavaScript RegExp \W Modifier Reviewed by 1000sourcecodes on 21:55 Rating: 5
Powered by Blogger.