JavaScript RegExp \SMetacharacter
JavaScript RegExp Object
Definition and Usage
The \S metacharacter is used to find non-whitespace characters.
Whitespace characters can be:
- Space character
- Tab character
- Carriage return character
- New line character
- Vertical tab character
- Form feed character
Syntax
new RegExp("\S")
Or a simpler way:
/\S/
Or a simpler way:
/\S/
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the \S metacharacter.
Example
Example
Perform a global search for non-whitespace characters in a string:
var str="Is this all there is?";
var patt1=/S/g;
var patt1=/S/g;
Belowmarkedtext shows where the expression gets a match:
Is this all there is?
Try it Yourself »
JavaScript RegExp Object Other Extensions