Regex only allow letters and some characters

前端 未结 4 944
孤街浪徒
孤街浪徒 2021-02-14 18:04

I am attempting to create a regex that only allows letters upper or lowercase, and the characters of space, \'-\', \',\' \'.\', \'(\', and \')\'. This is what I have so far but

4条回答
  •  我在风中等你
    2021-02-14 18:51

    The  -, in [a-zA-Z -,.()] describes a range from   (0x20) to , (0x2C). And that is equivalent to [ !"#$%'()*+,]. You should either escape the - or place it somewhere else where it is not interpreted as a range indicator.

    But that’s not the cause of this issue as the digits are from 0x30 to 0x39.

提交回复
热议问题