Javascript regex to reject non ASCII-US characters

前端 未结 1 1698
一向
一向 2020-12-10 10:14
^[^\\x00-\\x1F\\x7F-\\xFF]+$

This regex will properly fail to match a string that contains non-printing (hex 00-1f) or

相关标签:
1条回答
  • 2020-12-10 10:31

    Hmm... instead of rejecting byte ranges, try matching actual Unicode characters, e.g.:

    ^[\u0020-\u007e]+$
    0 讨论(0)
提交回复
热议问题