What is the difference between \s and \t?

后端 未结 4 607
既然无缘
既然无缘 2020-12-18 00:50

They both seem to work but I have been told you should use both when you\'re forming a RegExp?

4条回答
  •  感动是毒
    2020-12-18 01:51

    \s matches a single whitespace character, which includes spaces, tabs, form feeds, line feeds and other unicode spaces.

    \t Matches a single tab.

    If you are using \s, you don't need to include \t.

    More information on regex patterns here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp

提交回复
热议问题