Match whitespace but not newlines

后端 未结 6 1466
忘掉有多难
忘掉有多难 2020-11-22 15:57

I sometimes want to match whitespace but not newline.

So far I\'ve been resorting to [ \\t]. Is there a less awkward way?

6条回答
  •  长发绾君心
    2020-11-22 16:36

    m/ /g just give space in / /, and it will work. Or use \S — it will replace all the special characters like tab, newlines, spaces, and so on.

提交回复
热议问题