2013-11-14 70 views
4

当我在RegExr tool中尝试\(\((.+?)\)\)\(\(\s*(.+?)\s*\)\)时,我无法找到差异。两人都强调了相同的文字。有或没有\s*有什么区别。或者什么可能是有很好的理由\s*正则表达式中的(((。+?)))和(( s *(。+?) s * ))有什么区别?

我用下面的示例文本。

I (( a verb, past tense )) to the sandwich shop across the street for lunch 
yesterday. I go there at least ((a number)) times a week. They have the best 
Philly Cheesesteak, full of ((a plural noun)) and ((a plural noun)) and gooey, 
stringy ((a noun)). 

在此先感谢。

回答

4

明确的白色字符的第二个模式(\s*),修剪捕获组中的前导和尾随白色字符。但全球比赛并没有改变。

要看到gskinner不同的行为,你可以试试这个替换为两种模式:"#$1#"(其中$ 1是捕获组)

+0

谢谢,我已经忘记了这个词。 –

相关问题