Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time

Regex

Matching one string

"aaaa".match(/[a]/)

Result:

["a"]

Matching multiple substrings

"a a123a a123a b123b c".match(/a(123)a/g)

Result:

["a123", "a123"]

Note the trailing /g

  • You cannot select individual groups while using g