EmEditor (text editor) Forum Index
   Regular Expressions
     Changing every line inside a block
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
jugaor
Posted on: 12/21/2012 12:45 am
Just popping in
Joined: 11/29/2007
From: Lima, Perú
Posts: 19
Changing every line inside a block
Hi!
I have a very specific need with (x)html files… I want to replace every start of line between <div> blocks, to exclude'em from the next operations.

I tried
Search line: <div([^>\n]*>\s*)(<p\>[^>\n]*>[^\n]+?</p>\s*)+</div>
Replace: <div\1###\2</div>

\1 = optional parameters (i.e. "class")
\2 = every line, starting with <p>

But after the 'Replace All' operation, EM lets the block with only the last line (starting with ###)…
Is there any way to do this?

Thanks in advance,




----------------
jugaor
The guy with a terrible English

jugaor
Posted on: 12/26/2012 5:17 pm
Just popping in
Joined: 11/29/2007
From: Lima, Perú
Posts: 19
Re: Changing every line inside a block
I found that by changing the Search line to:
<div([^>\n]*>\s*)((<p\>[^>\n]*>[^\n]+?</p>\s*)+)</div>

EM doesn't lose any text, but only places the replacement ### at the first line ...

Any ideas, please?


----------------
jugaor
The guy with a terrible English

Yutaka
Posted on: 12/27/2012 1:00 pm
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2402
Re: Changing every line inside a block
Hello jugaor,

I am not sure what you would like to do. Can you please write a sample file so that we can figure out.

Thank you!





----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

Threaded | Newest First Previous Topic | Next Topic | Top


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