Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (20 sloc) 410 Bytes

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
You can’t perform that action at this time.