Sublime Forum

Matching any space in regex search

#1

When I try to use pattern \p{Zs} to match any kind of space, I get error:

Escape sequence was neither a valid property nor a valid character class name.  
The error occurred while parsing the regular expression: '\p{Zs}>>>HERE>>>'. in regular expression \p{Zs}

Is there any way that I can make this pattern work?

FYI: https://regex101.com/r/nnseOW/2

Thanks.
Manuel

0 Likes

#2

Does \s what you want?

0 Likes

#3

work in where?

From his link: \p{Zs} matches a whitespace character that is invisible, but does take up space
It doesn’t match new line for example.

0 Likes

#4

Thanks. No, \s matches only regular spaces, whereas \p{Zs} matches any kind of space (e.g. no-break space, thin no-break space, etc.).

0 Likes

#5

In regex matches and substitutions in Sublime Text editor (build 4143).

0 Likes

#6

Sublime Text claims to support the Perl Compatible Regular Expressions (PCRE) engine from the Boost library.

The link in my first post shows that PCRE regex support Unicode categories like \p{Zs}.

To me this looks like a bug, partial implementation of the regex engine or something like that.

0 Likes

#7

Iirc, it uses Boost regex https://www.boost.org/doc/libs/1_31_0/libs/regex/doc/syntax.html

But the latest Boost regex seems to just uses Perl regex :thinking: https://www.boost.org/doc/libs/1_82_0/libs/regex/doc/html/boost_regex/syntax.html

Having no idea which version of Boost regex ST uses though.

0 Likes

#8

On 08/14/2020. Sublime used version 1.64.0

Ref: https://discord.com/channels/280102180189634562/280157083356233728/743860094130978836

0 Likes