Sublime Forum

Locale-aware regular expressions

#1

Hello,

The \w and similar character classes ([a-z], :alpha:]], :word:]], etc.) are not locale-aware in the Find/Replace panel. For example, on my french computer, \w+ correctly matches “abcde” but not “àbcdé”. I have to manually type the following pattern instead [a-zàáâãäçèéêëìíîïòóôõöùúûüÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜŸ]+.

Does anyone know of a way to make ST take my locale into account? According to what I read, ST uses the Boost library for regular expressions. There seems to exist a collate flag for this purpose, but I don’t know how/where to set it in ST.

Thanks for any help
(ST2 build 2220 on Mac OS 10.7)

0 Likes

#2

interesting, I can use \w to match Chinese characters. Did you turn the regex option on?

0 Likes

#3

Thanks for your answer, prmaple. Chinese characters won’t match with \w here, I’ve just tested it.

If you mean the “.*” button in the Find panel, yes, of course.

0 Likes

#4

Hmm, you are right. Swedish characters (åäö) don’t match for me, even though my region locale is set to Swedish. That’s annoying.

0 Likes

#5

Thanks svenax, at least I am not the only one with this problem.

Still, I’d like to solve it :smile:. Any idea, anyone? Should I report a bug?

0 Likes

#6

[quote=“kofkof”]Thanks svenax, at least I am not the only one with this problem.

Still, I’d like to solve it :smile:. Any idea, anyone? Should I report a bug?[/quote]

Yes, please do. This is most likely a bug, unless Jon has a good explanation. I’d imagine using locale-aware regular expressions is slower, so maybe that’s the reason.

Apart from that, there’s nothing that you or I can do about it.

0 Likes

#7

Done.
Thank you!

0 Likes