EmEditor (text editor) Forum Index
   Regular Expressions
     Match some text followed by either newline or EOF ?
Register To Post

Flat Previous Topic | Next Topic
Poster Thread
Deipotent
Posted on: 7/13/2011 6:37 pm
Just can't stay away
Joined: 2/15/2008
From:
Posts: 118
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:


line1
line2
line3


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:

line1A, line2A, line3A


My Find regex would be something like

([[:alnum:]]+)\n


and the Replace regex would be

\1A, 


but this does not produce want I'm after due to it not matching the last line, so the end result is:

line1A, line2A, line3


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).
Flat Previous Topic | Next Topic


Subject Poster Date
   Match some text followed by either newline or EOF ? Deipotent 7/13/2011 4:08 pm
     Re: Match some text followed by either newline or EOF ? CrashNBurn 7/13/2011 5:23 pm
     » Re: Match some text followed by either newline or EOF ? Deipotent 7/13/2011 6:37 pm
         Re: Match some text followed by either newline or EOF ? CrashNBurn 7/13/2011 6:51 pm
           Re: Match some text followed by either newline or EOF ? Deipotent 7/13/2011 6:58 pm

Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文