Skip to content

regexp/no-standalone-backslash โ€‹

disallow standalone backslashes (\)

๐Ÿ“– Rule Details โ€‹

This rule disallows backslash (\) without escape.

E.g. the regular expression /\c/ without the unicode (u) flag is the same pattern as /\\c/.

In most cases, standalone backslashes are used by accident when a control escape sequence (\cX) or another escape sequence was intended. They are very confusing and should not be used intentionally.

This behavior is described in Annex B of the ECMAScript specification.

Now loading...

๐Ÿ”ง Options โ€‹

Nothing.

๐Ÿ“š Further reading โ€‹

๐Ÿš€ Version โ€‹

This rule was introduced in eslint-plugin-regexp v0.10.0

๐Ÿ” Implementation โ€‹