observablehq / inputs

Better input elements
https://observablehq.com/framework/lib/inputs
ISC License
127 stars 34 forks source link

Support non-ascii characters in search #216

Closed oluckyman closed 2 years ago

oluckyman commented 2 years ago

Inputs.search does not work with Cyrillic queries due to the problem with the word boundary assertion (\b). It supports only latin symbols:

image

This PR introduces negative lookbehind (?<!\S) instead of \b to detect a word boundary.

mootari commented 2 years ago

Safari does not support negative look behind.

Fil commented 2 years ago

(string).match(/[\p{L}-]+/ug) looks like a powerful solution (found at https://stackoverflow.com/questions/150033/regular-expression-to-match-non-ascii-characters).

(We don't want to only match words separated by spaces.)

tophtucker commented 1 year ago

Thanks for fixing this a whole, um, sixteen months ago, @oluckyman. Sorry for the ridiculous delay, but the fix is finally deployed to the site; you can see test cases for the new release here: https://observablehq.com/d/4303b3734fb950d8.

There's not really any good reason for the delay, we were just focused elsewhere. We're improved our internal processes for upgrading these libraries so more people can do it (like me!) and it shouldn't be so slow / such a bottleneck in the future. 😬 🙈 😅 🙏