在RAD Studio中使用正则表达式替换文本 [英] Replace text using regex in RAD Studio

查看:209
本文介绍了在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆