javascript 标签的javascript正则表达式后跟一个空格
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11086621/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
javascript regex for tab followed by a space
提问by DeltaTango
In Javascript what would be the regex for a tab followed by a space (EXACTLY THAT).
在 Javascript 中,选项卡后跟空格的正则表达式是什么(正是如此)。
I know it's something like:
我知道它是这样的:
var c = dataString.replace(/\t\s/g,'<br />');
But this is finding tabs or spaces globally, not a tab followed by a space as an exact match.
但这是全局查找制表符或空格,而不是制表符后跟空格作为完全匹配。
Thanks ahead of time!
提前致谢!
回答by Alnitak
It would be /\t /
这将是 /\t /
\s
also matches other whitespace characters, so you need a literal space character.
\s
还匹配其他空白字符,因此您需要一个文字空格字符。