JavaScript + Unicode regexes

前端 未结 11 1159
星月不相逢
星月不相逢 2020-11-21 05:11

How can I use Unicode-aware regular expressions in JavaScript?

For example, there should be something akin to \\w that can match any code-point in Lette

11条回答
  •  时光取名叫无心
    2020-11-21 05:33

    September 2018 (updated February 2019)

    It seems that regexp /\p{L}/u for match letters (as unicode categories)

    • works on Chrome 68.0.3440.106 and Safari 11.1.2 (13605.3.8)
    • NOT working on Firefox 65.0 :(

    Here is a working example

    In below field you should be able to to type letters but not numbers

    I report this bug here.

    Update

    After over 2 years according to: 1500035 > 1361876 > 1634135 finally this bug is fixed and will be available in Firefox v.78+

提交回复
热议问题