A bunch of upper- and lowercase letters followed by space and that exact bunch second time. For example: UserName UserName
or jnDJkjLKSdcSJ jnDJkjLKSdcSJ
.
The difference is that g1
doesn't match the repetition of this bunch, because there is no \1
in it.
Clarified:
/\b([a-zA-Z]+) \b/gi
/ start regexp
\b match a word boundary
(…) create a capturing group
[…] create a class of characters to match one of them
a-z match any character between "a" and "z" ("a", "b", "c", "d", "e" …)
A-Z match any character between "A" and "Z" ("A", "B", "C", "D", "E" …)
+ match one or more of a preceding token (see above)
match space sign (exactly)
\1 match first capturing group
\b match a word boundary
/gi finish regexp and set flags "global" and "case-insensitive"
\b([a-zA-Z]+) \b

(picture is clickable)