

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
JavaScript RegExp W Metacharacter
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.
Example
// Containing any non word character: console.log(/\W/.test(" ")) console.log(/\W/.test(".!@#")) // Not containing non word characters: console.log(/\W/.test("a")) console.log(/\W/.test("B")) console.log(/\W/.test("9")) console.log(/\W/.test("_"))
Output
true true false false false false
- Related Questions & Answers
- JavaScript RegExp s Metacharacter
- Regular Expression "W" Metacharacter in Java
- Explain Regular Expression "w" Metacharacter in Java
- w vs W in JavaScript regex?
- JavaScript RegExp test() Method
- JavaScript RegExp toString() Method
- RegExp object in JavaScript.
- Find digit with JavaScript RegExp.
- With JavaScript RegExp how to search a string for text that matches regexp?
- How to create RegExp object in JavaScript?
- How to replace string using JavaScript RegExp?
- Find digits between brackets in JavaScript RegExp?
- With JavaScript RegExp search a tab character.
- How to perform Multiline matching with JavaScript RegExp?
- With JavaScript RegExp find a character except newline?
Advertisements