用于动态表达式替换的正则表达式

RegEx for dynamic expression replacement

对于以下情况,我需要两个正则表达式:

1。 替换这个

lr_start_transaction("001_0010_123-A1-a_text-or-numbers");

有了这个

lr_start_transaction(lr_eval_string("{scriptid}_0010_123-A1-a_text-or-numbers"));

2。替换这个

lr_end_transaction("001_0010_123-A1-a_text-or-numbers",LR_AUTO);

有了这个

lr_end_transaction(lr_eval_string("{scriptid}_0010_123-A1-a_text-or-numbers"),LR_AUTO);

撇号之间的部分是动态的。

我正在使用 Notepad++ 编辑代码。

有人可以帮帮我吗???

你能不能只搜索看看 DEMO

(\(".*?)(_.*")

并将其替换为:

transaction(lr_eval_string("{scripted})

解释:

(\(".*?) // look for (" in a non-greedy way (capture in )
(_.*")   // look for an underscore up to the next quote (capture in )


transaction(lr_eval_string("{scripted})
// replace text, put back the capture group 2, then a closing parenthesis