Reputation: 5001
I'm not too familiar with the Notepad++ regex option for search and replace, and in need for a little help.
Parsing from one sql syntax to another, I would like to do the following. For all lines with the "pattern" ADD FOREIGN KEY "**********" ("**")
, I would like to insert som text at section 3 (where the whitespace is)
From
( 1 )( 2 )(3)(4)
ADD FOREIGN KEY "FK_MY_ACCOUNT_PROJECT" ("id")
to
ADD FOREIGN KEY "FK_MY_ACCOUNT_PROJECT" [new text] ("id")
Upvotes: 1
Views: 88
Reputation: 520978
Try this find and replace in regex mode:
Find:
(ADD FOREIGN KEY "[^"]+" )(\("[^"]+"\))
Replace:
$1[new text] $2
Here is a demo showing that the two groups in fact are getting matched correctly.
Upvotes: 2
Reputation: 6426
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:
(ADD FOREIGN KEY) "([^\\]*)" \("([^\\]*)"\)
you can replace with this:
\1 "\2" insertion ("\3")
Upvotes: 1