mirror of https://github.com/kkos/oniguruma.git
1
Characters that must be escaped
He Diyi edited this page 2019-10-04 23:06:28 +08:00
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.