I have seen the following code snippet used by other programmers in questions I am answering on coderbyte in javascript : /\b[a-z]/g
Can someone explain what this means / when it can be used?
Asked
Active
Viewed 5,559 times
-2

GitaarLAB
- 14,536
- 11
- 60
- 80

Martin Fielding
- 1
- 1
- 1
-
2This is called a [regular expression literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions). – Jon Nov 07 '14 at 00:08
3 Answers
4
It's a regular expression, composed of a word boundary and a character class, as a regexp literal.
In can be used to detect all lowercase letters at the beginning of a word.

Bergi
- 630,263
- 148
- 957
- 1,375
1
This is regexp(regular expression).
/[SOME CONTENT]/
"/" means inner content is regExp
then last "g" means search global

easywaru
- 1,073
- 9
- 17
0
This is a regular expression.
/\b[a-z]/g
selects the first letter of a word if it is lowercase
See below for an example of it being run on regexr.com

Bijan
- 7,737
- 18
- 89
- 149