在RAD Studio中使用正则表达式替换文本 [英] Replace text using regex in RAD Studio
问题描述
我想用RAD Studio IDE中的 H(X,Y); 替换 F(G(X,Y));
我使用的正则表达式是:
查找表达式: F \(G \\ $)$ / code
替换表达式: H($ 1)
结果不如我所料:
结果: H($ 1)
p>
似乎RAD Studio不会将$ 1识别为两个括号之间的内容。
有人有想法吗?
谢谢
使用{}对表达式而不是()和\\ \\ 1在替换文本中:
查找表达式: F \(G \({。+} \)\) / code>;替换表达式:
H(\0)
I want to replace for example F(G(X,Y)); with H(X,Y); In RAD Studio IDE.
The regex I use is:
Find Expression: F\(G\((.+)\)\);
Replace Expression: H($1)
The result is not as I expect:
Result: H($1)
It seems the RAD Studio does not recognize the $1 as the contents between two parentheses.
Anybody have an idea?
Thanks
Use {} to group the expression rather than () and \1 in the replacement text:
Find Expression: F\(G\({.+}\)\)
; Replace Expression: H(\0)
这篇关于在RAD Studio中使用正则表达式替换文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!