Skip to content

Regular Expressions#

A regular expression is a character sequence that specifies a pattern of a string. It can be used to find and replace strings.

String
\^ Start of string, or start of line in multi-line pattern
\A Start of string
\$ End of string, or end of line in multi-line pattern
\Z End of string
\b Word boundary
\B Not word boundary
< Start of word
\> End of word
Character Class
\c Control character
\s White space, same as [ \t\n\r\f\v]
\S Not white space
\d Digit, same as [0-9]
\D Not digit
\w Word, same as [a-zA-Z_]
\W Not word
\x Hexade­cimal digit
\O Octal digit
Character Class
. any character
\n Newline
\t tab
Quantifiers
? 0 or 1
* 0 or more
+ 1 or more
{3} Exactly 3
{3,} 3 or more
{3,5} 3, 4 or 5
Groups Description
(...) Active Group
(?:...) Passive (non-c­apt­uring) group
(?=...) look-ahead (passive)
(?!...) negative look-ahead (passive)
(?<=...) look-behind (passive)
(?!=...) negative look-behind (passive)
(?<!...) negative look-behind (passive)
(?>...) once (active)

Examples#

Match Pattern Regex
Date YYYY-MM-DD \d{4}-\d{2}-\d{2}
Email xx@xx.xx \S{1,}@\S{2,}\.\S{2,}
IPv4 ddd.ddd.ddd.ddd (?:[0-9]{1,3}\.){3}[0-9]{1,3}

Applet#

Your RegEx: \([^)]*\)">

Found Matches: