-
Notifications
You must be signed in to change notification settings - Fork 316
Characters that must be escaped
He Diyi edited this page Oct 4, 2019
·
1 revision
Outside of a class, ^$.?*+()[\|
must be escaped to be used literally.
Inside of a class, \[]^-
must be escaped to be used literally. This deserves a bit of clarification:
-
[
must be escaped to be used literally because it denotes the start of a set in a class. - Unescaped
]
can be used literally when it is placed at the very beginning of a class. - Unescaped
^
can be used literally when it is not placed at the beginning of a class. - Unescaped
-
can be used literally when it is placed at the beginning or end of a class.
In extended mode, #
becomes a metacharacter denoting the start of a comment, so it must be escaped to be used literally.