Regular expressions are represented by the Regex class, which is usually created with a literal:
foo_or_bar = /foo|bar/ heeello = /h(e+)llo/ integer = /\d+/
A regular expression literal is delimited by
/ and uses PCRE syntax.
It can be followed by these modifiers:
r = /foo/imx
Slashes must be escaped:
slash = /\//
An alternative syntax is provided:
r = %r(regex with slash: /)
To the extent possible under law, the persons who contributed to this workhave waived
all copyright and related or neighboring rights to this workby associating CC0 with it.