How to completely ignore linebreak and tab in RegEx?

后端 未结 4 747
-上瘾入骨i
-上瘾入骨i 2020-12-18 22:54

Is there any way to completely ignore line break and tab characters etc. in RegEx? For instance, the line break and tab characters could be found anywhere and in any order

4条回答
  •  盖世英雄少女心
    2020-12-18 23:09

    There is no way to "ignore" any type of character with regex. You can ignore letter case, but that's about it.

    Your best bet is to use \s+ where you would expect some type of whitespace. The \s class will match any whitespace, including newlines, carriage returns, tabs, and spaces, and this will make your regex pattern look a lot nicer.

提交回复
热议问题