Appendix A. Regular Expression Quick Reference Guide



Start of string, or start of line in multi-line pattern


End of string, or end of line in multi-line pattern


Word boundary


Not word boundary

Character Classes


White space


Not white space




Not digit




No Word


Hexadecimal digit (Used for matching hex code characters, such as "\xA9", as in "0xA9", for the copyright symbol; or "\x5B", as in "0x5B", for the open square bracket.)



White space


Not white space




Exactly 3


3 or more


3, 4, or 5

Escape Sequences


Escape following character

^ [ . $ { * ( \ + ) | ? < >

Special Characters


New line


Carriage return



Groups and Ranges


Any character except new line (\n)


Carriage return


a or b




Passive (non-c­apt­uring) group


Range (a or b or c)


Not (a or b or c)


Lower case letter from a to q


Upper case letter from A to Q


Digit from 0 to 7

String Replacement


nth non-passive group


"xyz" in /^(abc(xyz))$/


"xyz" in /^(?:abc)(xyz)$/


Before matched string


After matched string


Last matched string


Entire matched string