w3schools
  
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About

JavaScript RegExp \W Metacharacter


RegExp Object Reference JavaScript RegExp Object

Definition and Usage

The \W metacharacter is used to find a non-word character.

A word character is a character from a-z, A-Z, 0-9, including the _ (underscore) character.

Syntax

new RegExp("\W")

or simply:

/\W/


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The \W metacharacter is supported in all major browsers.


Example

Example

Do a global search for non-word characters in a string:

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

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

Give 100%!

Try it yourself »


RegExp Object Reference JavaScript RegExp Object

DreamTemplate

WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting
Top Web Hosting
Cheap UK Web Hosting
WEB BUILDING
XML Editor – Free Trial!
FREE Flash Website
FREE Web Templates
SEO Company
EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification
STATISTICS
Browser Statistics
Browser OS
Browser Display
FLIGHT TICKETS
Find the cheapest flight
to any destination now!
SHARE THIS PAGE