Purpose of [^\x20-\x7E] in regular expressions

前端 未结 4 1745
情深已故
情深已故 2020-12-13 18:04
 [^\\x20-\\x7E]

I saw this pattern used for a regular expression in which the goal was to remove non-ascii characters from a string. What does it

4条回答
  •  半阙折子戏
    2020-12-13 18:17

    It says something like: all characters that are not (^) in the range \x20-\x7E (hex 0x20 to 0x7E).

    According to http://www.asciitable.com/, those are characters from space to ~.

提交回复
热议问题