Regex TextPad正则表达式:如何查找和替换尖括号内的字符?
我有下面的示例文本Regex TextPad正则表达式:如何查找和替换尖括号内的字符?,regex,textpad,Regex,Textpad,我有下面的示例文本 Hello | World <Hi | Hello|How | are | you><test|string |for |regex> sample | text <however|replace|pipe> Hello | World 样本|文本 转换如下 Hello | World <Hi ~ Hello~How ~ are ~ you><test~string ~for ~regex> sample | t
Hello | World
<Hi | Hello|How | are | you><test|string |for |regex>
sample | text <however|replace|pipe>
Hello | World
样本|文本
转换如下
Hello | World
<Hi ~ Hello~How ~ are ~ you><test~string ~for ~regex>
sample | text <however~replace~pipe>
Hello | World
样本|文本
i、 e.将
中的
替换为~
我试过这个
()
但是它只匹配第一个
和角度
。我不知道该如何替换它。有什么方向吗?如果你的尖括号从来没有嵌套过,而且总是正确平衡的,那么你可以这样做:
\|(?=[^<>]*>)
\ |(?=[^]*>)
仅匹配下一个角括号为闭合角括号的管道字符。然后用~
替换匹配项
看到了