1
我试图获取两个特定匹配项之间的字符串,例如两个hashtags。正则表达式返回两个匹配项之间的字符串
我想什么来实现:
输入:
some text in front ##hi there## some text behind
输出:
hi there
随着/%%(.*)%%/
,则返回##hi there##
。
在此先感谢
我试图获取两个特定匹配项之间的字符串,例如两个hashtags。正则表达式返回两个匹配项之间的字符串
我想什么来实现:
输入:
some text in front ##hi there## some text behind
输出:
hi there
随着/%%(.*)%%/
,则返回##hi there##
。
在此先感谢
如果我想要多个匹配,比如说字符串是'there %% are %% two %% matches %% now' – nickosv
,什么是语言? –
@WiktorStribiżew对不起,我不知道这是相关的。这是PHP – nickosv
只要访问'$匹配[1]' –