noAddiction
noAddiction

Reputation: 81

Want to remove a function from multiple files using Notepad++

I have this 3 functions, looking exactly like this in multiple files, and using Notepad++, Find in Files/Replace in Files:

FirstLine
{
    //something here
}
SecondLine
{
    //something here
}
ThirthLine
{
    //something here
}

I want to remove the second function, the result should be like this:

FirstLine
{
    //something here
}
ThirthLine
{
    //something here
}

I have tried on regex101.com many times this is the last one i tried:

^.*(SecondLine).*\{.*\}.*$

just doesn't work, :(

Upvotes: 0

Views: 143

Answers (1)

noAddiction
noAddiction

Reputation: 81

This is what I ended up to use:

SecondLine[^\{]*\{[^\}]*\}\r*\n*

Notepad++ threw an Invalid regular expression error before I escaped braces. It seems closing braces should be escaped in a N++ regex to mean a literal } character.

Thank you all for the help!

Upvotes: 1

Related Questions