RakkoTools

Regular Expression Tester

Test Regular Expression of PHP/JavaScript/Python

Xのアイコン
Add to favorite
/ /

What this tool can

Input the regular expression and the target text, then highlights the part of the target text that matches the regular expression.
In PHP, the result of preg_match_all is also displayed.

What is the modifier?

Also known as flags, changes the behavior of regular expressions.
For example, if you want to match both “hello” and “Hello” regardless of case in the regular expression “/ hello /”, add “i” to the end of the pattern (//).



Special regex characters:

^Matches the beginning of a line.
For example, /^Apple/ matches 'Apple never falls...', but does not match 'An Apple a day...'.
$Matches the end of a line.
For example, /eat$/ matches 'Let's eat', but does not match 'In the eatery'.
.(dot or period) matches any other symbol except the newline character.
For example, /.n/ matches 'an' and 'on' in 'nay, an apple is on the tree', but not 'nay'.
If the s ('dotAll') flag is set to true, it also matches newline characters.
[xyz]Set of characters. Matches any one of the characters in the brackets, including escape sequences. Special characters like the dot(.) and asterisk (*) are not special inside a character set, so they don't need to be escaped. You can specify a range of characters by using a hyphen, as the following examples. The pattern [a-d], which performs the same match as [abcd], matches the 'b' in 'brisket' and the 'c' in 'city'. The patterns /[a-z.]+/ and /[\w.]+/ match the entire string 'test.i.ng'.
*Matches the preceding pattern 0 or more times. Equivalent to {0,}.
For example, /bo*/ matches 'boooo' in 'A ghost booooed' and 'b' in 'A bird warbled' but nothing in 'A goat grunted'.
+Matches the preceding pattern 1 or more times. Equivalent to {1,}. For example, /a+/ matches the 'a' in 'candy' and all the a's in 'caaaaaaandy', but nothing in 'cndy'.
?Matches the preceding pattern 0 or 1 time. Equivalent to {0,1}.
For example, /e?le?/ matches the 'el' in 'angel' and the 'le' in 'angle' and also the 'l' in 'oslo'. If used immediately after any of the quantifiers *, +, ?, or {}, makes the quantifier non-greedy (matching the fewest possible characters), as opposed to the default, which is greedy (matching as many characters as possible).
For example, applying /\d+/ to '123abc', matches '123'. But applying /\d+?/ to that same string, matches only the '1'. Also used in lookahead assertions, as described in the x(?=y) and x(?!y) entries of this table.
{n} Preceding character is to be repeated n times. The n must be a positive integer.
For example, /a{2}/ match all of the a's in 'caandy,' and the first two a's in 'caaandy.' but it does not match the 'a' in 'candy'.
{m,n}Preceding character is to be repeated at least n and at most m times. When m is omitted, it is treated as ∞.(n and m are positive integers and n <= m)
For example, /a{1,3}/ matches nothing in 'cndy', the 'a' in 'candy,' the first two a's in 'caandy,' and the first three a's in 'caaaaaaandy'. Notice that in the case of 'caaaaaaandy', the match is 'aaa', even though the original string had more a's in it.
a-zMatches any single character from a to z
A-ZMatches any single character from A to Z
0-9Matches any single character from 0 to 9


Useful for

  • Searching for patterns in text and checking if it is correct
  • Dividing and extracting text based on defined pattern
  • Verifying with using test text if the description of the regular expression is correct

related tools