From 2b295a265ea3c5e6ec5b5b6d8bdfc02fd0c7a4d6 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 26 Oct 2017 13:52:29 +0800 Subject: [PATCH] Regex: Add a Compatibility section to the regex documentation Refer more explicitely to ECMAScript and document the incompatibilities with it. --- doc/manpages/regex.asciidoc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/manpages/regex.asciidoc b/doc/manpages/regex.asciidoc index b45a8e1f..81c47c96 100644 --- a/doc/manpages/regex.asciidoc +++ b/doc/manpages/regex.asciidoc @@ -9,7 +9,7 @@ Regex Syntax ------------ Kakoune regex syntax is based on the ECMAScript syntax, as defined by the -ECMA-262 standard. +ECMA-262 standard (see <>). Kakoune's regex always run on Unicode codepoint sequences, not on bytes. @@ -181,3 +181,17 @@ the regex, or the appearance of `\E`. For example `.\Q.^$\E$` will match any character followed by the literal string `.^$` followed by an end of line. + +Compatibility +------------- + +The syntax tries to follow the ECMAScript regex syntax as defined by +https://www.ecma-international.org/ecma-262/8.0/ some divergences +exists for ease of use or performance reasons: + +* lookarounds are not arbitrary, but lookbehind are supported. +* `\K`, `\Q..\E`, `\A`, `\h` and `\z` are added. +* Stricter handling of escaping, as we introduce additional + escapes, identity escapes like `\X` with X a non-special character + are not accepted, to avoid confusions between `\h` meaning literal + `h` in ECMAScript, and horizontal blank in Kakoune.