Ruby Regular Expression Editor

/ /
Character Classes
.Any char (except newline)
\d \DDigit / non-digit
\w \WWord char / non-word
\s \SWhitespace / non-whitespace
\h \HHex digit / non-hex
[abc]Character set
[^abc]Negated set
[a-z]Range
\p{L}Unicode property
Special
\KMatch reset (keep left)
\RAny line break
Anchors
^ $Start / end of line
\A \zStart / end of string
\ZEnd (before final \n)
\b \BWord boundary / non
\GPrevious match end
Quantifiers
* + ?0+, 1+, 0 or 1
{n}Exactly n
{n,} {n,m}n or more, n to m
*? +? ??Lazy versions
Groups
(...)Capture group
(?:...)Non-capturing
(?<name>...)Named capture
\1 \k<name>Backreference
a|bAlternation
Lookaround
(?=...)Positive lookahead
(?!...)Negative lookahead
(?<=...)Positive lookbehind
(?<!...)Negative lookbehind