What is the use of \w in regex?
A. Used for a whitespace character
B. Used for a non-whitespace character
C. Used for a word character
D. Used for a non-word character
Answer:C
What is the use of \w in regex?
A. Used for a whitespace character B. Used for a non-whitespace character C. Used for a word character D. Used for a non-word character
Explanation: In java, the “\w” regex is used to match with a word character consists of [a-zA-Z_0-9]. For example, \w+ matches one or more word character that is same as ([a-zA-Z_0-9] +).