Regular expression to match a white space character.
var RE_WHITESPACE = require( '@stdlib/regexp/whitespace' );
Regular expression to match a white space character.
var bool = RE_WHITESPACE.test( '\n' );
// returns true
bool = RE_WHITESPACE.test( ' ' );
// returns true
bool = RE_WHITESPACE.test( '\\n' );
// returns false
- Matches the
25
characters defined as white space ("WSpace=Y","WS") characters in the Unicode9.0
character database. - Matches one related white space character without the Unicode character property "WSpace=Y" (zero width non-breaking space which was deprecated as of Unicode 3.2).
var RE_WHITESPACE = require( '@stdlib/regexp/whitespace' );
var bool;
var str;
bool = RE_WHITESPACE.test( 'beep boop' );
// returns true
bool = RE_WHITESPACE.test( '\n' );
// returns true
bool = RE_WHITESPACE.test( '\r' );
// returns true
bool = RE_WHITESPACE.test( '\t' );
// returns true
bool = RE_WHITESPACE.test( 'beep' );
// returns false
str = 'This is\na newline\r\ndelimited string.';
var arr = str.split( RE_WHITESPACE );
// returns [ 'This', 'is', 'a', 'newline', '', 'delimited', 'string.' ]