\s 和 \t 有什么区别? [英] What is the difference between \s and \t?

查看:82
本文介绍了\s 和 \t 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它们似乎都有效,但有人告诉我,在形成 RegExp 时应该同时使用它们?

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

推荐答案

\s 匹配单个空白字符,包括空格、制表符、换页符、换行符和其他 unicode 空格.

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

\s>

\t 匹配单个标签.

如果您使用的是 \s,则不需要包含 \t.

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

有关正则表达式模式的更多信息,请访问:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp

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

这篇关于\s 和 \t 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆