How to use predefined character classes regex?
In regex, you also have a number of predefined character classes that provide you with a shorthand notation for commonly used sets of characters.
Here are the list:
. : represent any character.
d : represent any digit, shorthand for
D : represent a non digit,
s : represent a whitespace character
S : represent any non whitespace character
w : represent word character
W : represent a non word character
This program output the following result:
Text " fox" found at 15 to 19.