EmEditor (text editor) Forum Index Regular Expressions
Match some text followed by either newline or EOF ? | Register To Post |
| Threaded | Oldest First | Previous Topic | Next Topic | Bottom |
| Poster | Thread |
|---|---|
| Deipotent | Posted on: 7/13/2011 6:58 pm |
Just can't stay away ![]() ![]() Joined: 2/15/2008 From: Posts: 122 |
Re: Match some text followed by either newline or EOF ? Thanks CrashNBurn! The last regex is what I'm after
|
| CrashNBurn | Posted on: 7/13/2011 6:51 pm |
Just can't stay away ![]() ![]() Joined: 4/8/2010 From: Posts: 130 |
Re: Match some text followed by either newline or EOF ? I can't reproduce what you are claiming in this case.
I've tried with both unix-LF and windows-CRLF files. This Search: ([[:alnum:]]+)\n Replace: \1, Results in:Quote: AString, ANotherString, YetAnotherString, EvenMoreString |
| Deipotent | Posted on: 7/13/2011 6:37 pm |
Just can't stay away ![]() ![]() Joined: 2/15/2008 From: Posts: 122 |
Re: Match some text followed by either newline or EOF ? I didn't mention it in my original post, but I want to replace the newline, where present. For example, suppose I have three lines:
There is a newline character after "line1" and "line2", but not after "line3". I want to use a Find/Replace regex to convert it into the following: My Find regex would be something like and the Replace regex would be but this does not produce want I'm after due to it not matching the last line, so the end result is: That is, no "A, " after "line3". So, I was hoping for a way to match either a \n or EOF, and replace the \n, but not the EOF (as that's obviously just a virtual char). |
| CrashNBurn | Posted on: 7/13/2011 5:23 pm |
Just can't stay away ![]() ![]() Joined: 4/8/2010 From: Posts: 130 |
Re: Match some text followed by either newline or EOF ? Search for: sometext$
|
| Deipotent | Posted on: 7/13/2011 4:08 pm |
Just can't stay away ![]() ![]() Joined: 2/15/2008 From: Posts: 122 |
Match some text followed by either newline or EOF ? I know you can use \n to match a newline, but how do you match either newline OR EOF ?
I want it to match all lines, including the last line, which have some specific text followed by either newline or EOF. For example, I can use "sometext\n", but this won't match on the last line. |
| Threaded | Oldest First | Previous Topic | Next Topic | Top |
| Register To Post | |


