Skip to content

Conversation

@jo-he
Copy link
Contributor

@jo-he jo-he commented Dec 10, 2025

With ., Kakoune matches newlines by default. Therefore \N comes in very handy, as it is quicker to type than the commonly used patterns (?S). and [^\n].

\n is to \N as \h is to \H – the inverse.

But this patch does not implement \N as a character class – instead it just creates an alias for . in (?S) mode.

And, as with PCRE, \N is not allowed in [ ] character classes (where it would not make much sense).

This way the implementation is very simple.

(Perl and PCRE additionally support the pattern '\N{U+XXX..}', which has a different meaning. Kakoune already covers this functionality by '\uXXXXXX'. So '\N' is unambiguous here.)

See also:

https://www.pcre.org/current/doc/html/pcre2pattern.html#SEC7

https://perldoc.perl.org/perlre#Character-Classes-and-other-Special-Escapes

find my Copyright Waiver in commit ab87d2b

With `.`, Kakoune matches newlines by default. Therefore
`\N` comes in very handy, as it is quicker to type than
the commonly used patterns `(?S).` and `[^\n]`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant