into如果您要去the_fair a_trader,那将为您提供公平的价格
我知道如何以各种方式捕获这些特定字符串e.g。
(the fair)|(a trader)|(offer you)
或者
(the)(\s)(fair)|(a)(\s)(trader)|(offer)(\s)(you)
等
但我不知道如何处理捕获组的编号,以便任何一个都会发生相同的替换(到下划线)。 我尝试:
1。 寻找
(the)(?:\s)(fair)|(a)(?:\s)(trader)|(offer)(?:\s)(you)
代替
$1_$2
2。 寻找
(the|a|offer)(?:\s)(fair|trader|you)
代替
$1_$2
result
If you are going to the_fair a_trader there will offer_you a_fair price
我不确定还要尝试什么。抱歉,如果我不正确地表达问题;我是这个新的
ctrl+
H
(?<=the)\h+(?=fair)|(?<=a)\h+(?=trader)|(?<=offer)\h+(?=you)
_
ticktrap周围
(?<=the) # positive lookbehind, make sure we have "the" before
\h+ # horizontal spaces
(?=fair) # positive lookahead, make sure we have "fair" after
| # OR
(?<=a) # positive lookbehind, make sure we have "a" before
\h+ # horizontal spaces
(?=trader) # positive lookahead, make sure we have "trader" after
| # OR
(?<=offer) # positive lookbehind, make sure we have "ofer" before
\h+ # horizontal spaces
(?=you) # positive lookahead, make sure we have "you" after
Screenshot(之后):