Loading Ruby...
Test String
Ruby
Matches
Match Details
Substitution Result
| Character Classes | |
|---|---|
| . | Any char (except newline) |
| \d \D | Digit / non-digit |
| \w \W | Word char / non-word |
| \s \S | Whitespace / non-whitespace |
| \h \H | Hex digit / non-hex |
| [abc] | Character set |
| [^abc] | Negated set |
| [a-z] | Range |
| \p{L} | Unicode property |
| Special | |
| \K | Match reset (keep left) |
| \R | Any line break |
| Anchors | |
|---|---|
| ^ $ | Start / end of line |
| \A \z | Start / end of string |
| \Z | End (before final \n) |
| \b \B | Word boundary / non |
| \G | Previous 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|b | Alternation |
| Lookaround | |
| (?=...) | Positive lookahead |
| (?!...) | Negative lookahead |
| (?<=...) | Positive lookbehind |
| (?<!...) | Negative lookbehind |