[英]Regex (Notepad++) to search and replace content
I'm not too familiar with the Notepad++ regex option for search and replace, and in need for a little help. 我不太熟悉用于搜索和替换的Notepad ++正则表达式选项,并且需要一些帮助。
Parsing from one sql syntax to another, I would like to do the following. 从一种sql语法解析到另一种,我想做以下几点。 For all lines with the "pattern" ADD FOREIGN KEY "**********" ("**")
, I would like to insert som text at section 3 (where the whitespace is) 对于带有“pattern” ADD FOREIGN KEY "**********" ("**")
所有行,我想在第3节插入som文本(空格所在的位置)
From 从
( 1 )( 2 )(3)(4)
ADD FOREIGN KEY "FK_MY_ACCOUNT_PROJECT" ("id")
to 至
ADD FOREIGN KEY "FK_MY_ACCOUNT_PROJECT" [new text] ("id")
Sounds like a job for... Regular Expressions! 听起来像... ...正则表达式的工作! Na na na na na n-- 娜娜娜娜 -
Oh, wait... You already knew that... :-/ 哦,等等......你已经知道......: - /
Anyway... In the "replace" box you can use \\6
to refer to a numbered group, so if you have a regex like this: 无论如何......在“替换”框中,您可以使用\\6
来引用编号组,因此如果您有这样的正则表达式:
(ADD FOREIGN KEY) "([^\\]*)" \("([^\\]*)"\)
you can replace with this: 你可以用这个代替:
\1 "\2" insertion ("\3")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.