Regex Tester 14
Regular expression to test
Some examples:
/(abc|\d)/g
Your regular expression:
//g
Flags
global search
(g) Finds all the correspondences rather than stopping after the first match
case insensitive
(i) Case is ignored
multiline
(m) Start and end characters (^ and $) are treated as working on each line
unicode
(u) Treat the regular expression as a sequence of Unicode code points
sticky
(y) Matches only from the index indicated by the lastIndex property of this regular expression
dot all
make . match newline too. (s) Dot metacharacter matches all characters, including newlines
comment
(x) Ignore whitespace in regex
anchored
(A) Forced to be "anchored", that is, it is constrained to match only at the start of the string which is being searched
dollar end only
(D) Dollar metacharacter matches only at the end of the subject string
extra analysis
(S) Extra analysis is performed
ungreedy
(U) Inverts the "greediness" of the quantifiers so that they are not greedy by default, but become greedy if followed by ? (Not compatible with Perl)
extra
(X) Turns on additional functionality of PCRE that is incompatible with Perl
jchanged
(J) Allow duplicate names for subpatterns
UNIX_LINES
(l) Enables UNIX lines mode. Only the '\n' line terminator is recognized in the behavior of ., ^, and $.
CANON_EQ
(c) Enables canonical equivalence.
LITERAL
(L) Enables literal parsing of the pattern.
UNICODE_CHARACTER_CLASS
(C) Enables the Unicode version of Predefined character classes and POSIX character classes.
String to test
Generate a string from RegEx
Explanation
Substitution
Quick Guide
RegEx Engine
JavaScript
Python 3.10
Ruby 3.2
Java 17
PHP 8
Anchors
$
End of string or end of line (in multi-line pattern)
^
Start of string or start of line (in multi-line pattern)
\b
Word boundary
\B
Not word boundary
Quantifiers
x?
0 or 1
x+
1 or more
*
0 or more
{2}
Exactly 2
{2,}
2 or more
{2,5}
Between 2 and 5
Metacharacters
.
Any single character except line break (\n, \r)
\w
Word character
\W
Non-word character
\d
Digit
\D
Non-digit character
\s
Whitespace character ([ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff])
\S
Non-whitespace character
\b
Beginning/end of a word
\B
Not at the beginning/end of a word
\n
New line character
\r
Carriage return character
\t
Tab character
\v
Vertical tab character
\0
NUL character
\f
Form feed character
\xxx
Character specified by an octal number xxx
\xdd
Character specified by an hexadecimal number dd
\udddd
Unicode character specified by an hexadecimal number dddd
Brackets
[xyz]
Any character between the brackets
[^xyz]
Any character not between the brackets
[x-z]
Any character from x to z
[^x-z]
NOT (Any character from x to z)
(x|y)
Any of the alternatives specified