Copy regular expressions to a single click

Regex Test and Debug Online – Python, Javascript, PCRE, PHP

What are regular expressions?

regular expression (regex) defines a search pattern for strings. The search pattern can be anything from a simple character, a fixed string or a complex expression containing special characters describing the pattern.

A regex can be used to search, edit and manipulate text, this process is called: The regular expression is applied to the text/string.

The regex is applied on the text from left to right. Once a source character has been used in a match, it cannot be reused. For example, the regex aba will match ababababa only two times (aba_aba__).

Insert your regular expression and test string:





Common matching symbols:

.Matches any character
^regexFinds regex that must match at the beginning of the line.
regex$Finds regex that must match at the end of the line.
[abc]Set definition, can match the letter a or b or c.
[abc][vz]Set definition, can match a or b or c followed by either v or z.
[^abc]When a caret appears as the first character inside square brackets, it negates the pattern. This pattern matches any character except a or b or c.
[a-d1-7]Ranges: matches a letter between a and d and figures from 1 to 7, but not d1.
X|ZFinds X or Z.
XZFinds X directly followed by Z.
$Checks if a line end follows.

Meta characters:

\dAny digit, short for [0-9]
\DA non-digit, short for [^0-9]
\sA whitespace character, short for [ \t\n\x0b\r\f]
\SA non-whitespace character, short for
\wA word character, short for [a-zA-Z_0-9]
\WA non-word character [^\w]
\S+Several non-whitespace characters
\bMatches a word boundary where a word character is [a-zA-Z0-9_]


*Occurs zero or more times, is short for {0,}X* finds no or several letter X, <sbr /> .* finds any character sequence
+Occurs one or more times, is short for {1,}X+– Finds one or several letter X
?Occurs no or one times, ? is short for {0,1}.X? finds no or exactly one letter X
{X}Occurs X number of times, {} describes the order of the preceding liberal\d{3} searches for three digits, .{10} for any character sequence of length 10.
{X,Y}Occurs between X and Y times,\d{1,4} means \d must occur at least once and at a maximum of four.
*?? after a quantifier makes it a reluctant quantifier. It tries to find the smallest match. This makes the regular expression stop at the first match.