8.16.0.4
5.5.4 Regexp Quick Reference🔗ℹ

Regexp operators:

 

string

 

Match literal string; see #%literal

 

bytes

 

Match literal byte string; see #%literal

 

pat pat

 

Match concatenation of matches; see #%juxtapose

 

pat ++ pat

 

Match concatenation of matches

 

(pat)

 

Same as pat

 

[charset]

 

Match any in charset; see #%brackets

 

pat || pat

 

Match either pat

 

pat *

 

Zero or more repetitions of pat

 

pat +

 

One or more repetitions of pat

 

pat ?

 

Zero or one matches of pat

 

pat {min .. max}

 

min to max-1 repetitions of pat; see #%comp

 

pat {min ..= max}

 

min to max repetitions of pat; see #%comp

 

.

 

Any non-newline character

 

any

 

Any character

 

char

 

Like any, but implies string mode

 

byte

 

Like any, but implies byte-string mode

 

bof

 

Beginning of input (i.e., “file”)

 

eof

 

End of input (i.e., “file”)

 

bol

 

Beginning of a line

 

eol

 

End of a line

 

$ id: pat

 

Capture group, set id to match for pat

 

$ id

 

Backreference, match same as id

 

$ int

 

Backreference, match same as int

 

$ expr

 

Splice: match pattern produced by expr

 

~~ pat

 

Anonymous capture group match pat

 

lookahead(pat)

 

Match empty if pat matches after

 

lookbehind(pat)

 

Match empty if pat matches before

 

! lookahead(pat)

 

Match empty if pat does not match after

 

! lookbehind(pat)

 

Match empty if pat does match before

 

word_boundary

 

Match empty outside of word

 

word_continue

 

Match empty within word

 

if tst | pat | pat

 

Condition on lookahead, lookbehind, or backreference

 

cut

 

Match empty, but limit backtracking

 

string: pat

 

Specify string mode, match pat

 

bytes: pat

 

Specify byte-string mode, match pat

 

case_sensitive: pat

 

Match pat case-sensitively

 

case_insensitive: pat

 

Match pat case-insensitively

Character sets that can be used directly as regexp operators:

 

alpha

 

ASCII letters a-z and A-Z

 

upper

 

ASCII uppercase letters A-Z

 

lower

 

ASCII lowercase letters a-z

 

digit

 

ASCII digits 0-9

 

xdigit

 

Hexadecimal digits 0-9, a-f, and A-F

 

alnum

 

alpha plus digit

 

word

 

alnum plus _

 

newline

 

Newline (ASCI 10)

 

blank

 

Space (ASCI 32) and tab (ASCI 7)

 

space

 

Newline (10), return (13), space (32), tab (7), and form feed (12)

 

graph

 

ASCII characters that print with ink

 

print

 

graph plus space

 

cntrl

 

ASCII control character(ASCII 0 through 31)

 

ascii

 

ASCII characters (ASCII 0 through 127)

 

latin1

 

Latin-1 characters (Unicode 0 through 255)

 

unicode.Ll

 

Character in a Unicode general category Ll

 

unicode.cat

 

Character in other Unicode general category...

Character sets that can be used directly as regexp operators:

 

string

 

All characters in string

 

bytes

 

All bytes in bytes

 

(charset)

 

Same as charset

 

charset charset

 

Union of charsets; see #%juxtapose

 

charset - charset

 

Inclusive range between single-element charsets

 

charset || charset

 

Union of charsets

 

charset && charset

 

Intersection of charsets

 

charset -- charset

 

Difference of charsets

 

! charset

 

Inverse of charset

 

any

 

All characters