Regular expressions to replace

一个人想着一个人 提交于 2019-12-12 03:24:20

问题


I need to replace a bunch of lines for SQL queries

The format is like

"xyzabcd > hdsd + 5 and",
"xzbcd_TTM_dfdfd > hdsd + 20 and",
"x_TTM_dfsddsdsdfd > hdsd + 20 and"

I need to find the keyword TTM and add a "(" at the beginning and " or some condition)" in the end but before the word "and"

So the line

"xzbcd_TTM_dfdfd > hdsd + 20 and",

becomes

"(xzbcd_TTM_dfdfd > hdsd + 20 or some condition) and

I am trying to do it in Textpad but I can also use Notepad++. Thanks a lot in advance.


回答1:


For Notepad++ and for TextPad you can use

Search:

"(.+)\sand",*

Replace:

"\(\1 OR some condition\) AND


来源:https://stackoverflow.com/questions/35814461/regular-expressions-to-replace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!