User Tools

Site Tools


regularexpressions

RegEx

Quantifiers

*0 or more
+1 or more
?0 or 1
{3}Exactly 3
{3,}3 or more
{3,5}3, 4 or 5

Groups and Ranges

. Any character except new line
(a{|}b)a or b
(…)Group
(?:…)Passive Group
{[abc}Range (a or b or c)
{[^abc}Not a or b or c
{[a-q}Letter between a and q
{[A-Q}Upper case between A and Q
{[0-7}Digit between 0 and 7
\nDigit between 0 and 7

Anchors

^ or \A Start of string
$ or \Z End of string
\b Word boundary
\B Not word boundary
\< Start of word
\> End of word

POSIX

{[:upper:}Upper case letters
{[:lower:}Lower case letters
{[:alpha:}All letters
{[:alnum:}Digits and letters
{[:digit:}Digits
{[:punct:}Punctuation
{[:blank:}Space and tab
{[:space:}Blank characters
{[:word:}Digits, letters and underscore

Character Classes

\c Control character
\s White space
\S Not white space
\d Digit
\D Not digit
\w Word
\W Not word

Special Characters

\ Escape Character
\n New line
\r Carriage return
\t Tab
\v Vertical tab
\f Form feed
regularexpressions.txt · Last modified: 2017/11/09 02:52 by mark