Page MenuHomePhabricator

Whole word match and regex not working for non-Latin characters like Greek
Closed, InvalidPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Use a text with these words: λέξη, λέξης, αλέξης
  • Try whole word match with λέξη; then try regex with \bλέξη\b; try replace with anything in both cases
  • Press replace or replace all. You get "Your search did not match anything."

What happens?:
Nothing is replaced.

What should have happened instead?:

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
https://test.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&action=edit

Other information (browser name/version, screenshots, etc.):
https://www.mediawiki.org/wiki/Topic:Ye5hnbxt7t8bqpx4

Event Timeline

AFAIK it is not something to do with WikiEditor (2010): this is how JavaScript regular expressions usually work. \b only works as a word boundary for Latin symbols. Test it out at https://regexr.com by adding a Greek word or even Cyrillic word like пример and using a regex to find it. It will do so with Latin but won’t with Cyrillic/Greek/any other Unicode. That can’t be fixed by WikiEditor (or any other extension that supports regex), it can only be fixed by browser vendors.

This is definitely a browser/JavaScript issue and not one with WikiEditor. https://regex101.com/?regex=%5Cb%CE%BB%CE%AD%CE%BE%CE%B7%5Cb&testString=%CE%BB%CE%AD%CE%BE%CE%B7%2C+%CE%BB%CE%AD%CE%BE%CE%B7%CF%82%2C+%CE%B1%CE%BB%CE%AD%CE%BE%CE%B7%CF%82&flags=mui&flavor=javascript&delimiter=%2F shows that JavaScript in general doesn't match that regex (though the site also shows that PHP does).

Closing per last comments.