Retain the wildcard when replacing string

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
kosmetikstudio
Forum Newbie
Posts: 1
Joined: Sun Aug 30, 2009 12:47 pm

Retain the wildcard when replacing string

Post by kosmetikstudio »

Hi there, I´ve been trying to raplace some strings in some files using Notepad++.

I of course need to find the appropriate string, which is not that big of a problem:

Code: Select all

TAG(.*)myemail@gmail.com
But what I need to do now is, insert a line break before "TAG", but only before those lines, that contain my email adress at the end. ? I have been searching way too long for this, hope that someone has a quick answer :).

Thanks in advance!
User avatar
ridgerunner
Forum Contributor
Posts: 214
Joined: Sun Jul 05, 2009 10:39 pm
Location: SLC, UT

Re: Retain the wildcard when replacing string

Post by ridgerunner »

If I understand you correctly, you would like to add a newline before any 'TAG' which has your email following it on the same line. Assuming that your linebreak is just a \n newline (and not a carriage return newline \r\n combination), try this:

Code: Select all

Find what:
(TAG.*myemail@gmail\.com)
 
Replace with:
\n\1
You did not provide a very clear description of your problem. Next time, please provide some sample text that is representative of the data you are searching through as well as some text thst shows what you want it to look like when its finished. (i.e. Read the posting guidelines)
Post Reply