正则表达式以匹配字符串的最后一次出现
RegEx to match last occurence of a string
对于给定的段落,
test of reg ex
This is a test of foo bar.
This is a test foo.
This is a test of foo bar.
This is a test foo.
This is a test of foo bar.
This is a test foo.
有没有办法只匹配上面的粗体或斜体文本?
/test of.*is a/s
会匹配第一个测试,这不是我想要的。
我们可以在不使用 Negative Look ahead 的情况下执行此操作吗?
我正在使用记事本++的正则表达式引擎进行一些文本操作
我想你可以像这样使用两个正则表达式
/^[\S\s]*?(test of foo bar\.\s*This is a)/g
对于粗体和对于斜体
/[\S\s]*(test of foo bar\.\s*This is a)/g
^[\s\S]*\Ktest of foo bar\.[\s\S]*?This is a
您可以使用 \K
here.See 演示。
对于给定的段落,
test of reg ex
This is a test of foo bar.
This is a test foo.
This is a test of foo bar.
This is a test foo.
This is a test of foo bar.
This is a test foo.
有没有办法只匹配上面的粗体或斜体文本?
/test of.*is a/s
会匹配第一个测试,这不是我想要的。
我们可以在不使用 Negative Look ahead 的情况下执行此操作吗?
我正在使用记事本++的正则表达式引擎进行一些文本操作
我想你可以像这样使用两个正则表达式
/^[\S\s]*?(test of foo bar\.\s*This is a)/g
对于粗体和对于斜体
/[\S\s]*(test of foo bar\.\s*This is a)/g
^[\s\S]*\Ktest of foo bar\.[\s\S]*?This is a
您可以使用 \K
here.See 演示。