Regex modifier /u in JavaScript?

后端 未结 3 859
说谎
说谎 2020-12-31 03:28

Recently I have created a regex, for my PHP code which allows only the letters (including special characters plus spaces), but now I\'m having a problem with converting it (

3条回答
  •  星月不相逢
    2020-12-31 03:58

    The /u modifier is for unicode support. Support for it was added to JavaScript in ES2015.

    Read http://stackoverflow.com/questions/280712/javascript-unicode to learn more information about unicode in regex with JavaScript.


    Polish characters:

    Ą \u0104
    Ć \u0106
    Ę \u0118
    Ł \u0141
    Ń \u0143
    Ó \u00D3
    Ś \u015A
    Ź \u0179
    Ż \u017B
    ą \u0105
    ć \u0107
    ę \u0119
    ł \u0142
    ń \u0144
    ó \u00F3
    ś \u015B
    ź \u017A
    ż \u017C
    

    All special Polish characters:

    [\u0104\u0106\u0118\u0141\u0143\u00D3\u015A\u0179\u017B\u0105\u0107\u0119\u0142\u0144\u00F3\u015B\u017A\u017C]
    

提交回复
热议问题