Regular expression to restrict Extended ASCII character set

前端 未结 3 1061
粉色の甜心
粉色の甜心 2021-01-23 16:09

I have multi lingual application which creates xml files but Extended ASCII characters from 168 to 254 (¿⌐¬½¼¡«»░▓│┤╡╢╖╕╣║╗╜╛┐└┴┬├) are not supposed in XML tags so, I would like

3条回答
  •  迷失自我
    2021-01-23 16:42

    Rather you can make use of range in character class, to exclude specific range of characters using their Hex Codes: -

    [^\xA8-\xFE]
    

    The above regex will match any character except those in the given range. Those are the hex codes for the range you posted - [168, 254]

提交回复
热议问题