Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove everything before string in Notepad++

I would like to remove everything before a string 'EXEC'. How to do that in Notepad++?

There are many examples with regular expressions and special characters but my sentence has two EXEC so none of them solved my problem. I want to ignore EXECUTION and remove everything before EXEC.

Example:

Abcdefghijklmn EXECUTION EXEC myfilename here

Expected Result:

EXEC myfilename here
like image 315
Tech Learner Avatar asked Dec 06 '22 13:12

Tech Learner


1 Answers

Try this Regex:

^.*(?=EXEC\s)

Click for Demo

Explanation:

  • ^ - Start of the String
  • .* - 0+ occurrences of any character which is not a newline character
  • (?=EXEC\s) - Positive lookahead which returns the position which is immediately followed by EXEC(with a space)

OUTPUT:

Before replacing:

enter image description here

After replacing:

enter image description here

like image 116
Gurmanjot Singh Avatar answered Dec 18 '22 17:12

Gurmanjot Singh