View Single Post
Old 05-18-2013, 10:21 AM   #2
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,825
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by kakkalla View Post
HI all.

I search for this type of code:
Code:
<p class="list1"><span class="list1">2.</span>Mathematics disorder (315.1)</p>
In the Find panel, I have:
Code:
<p class="(list.+)"><span class="(list.*)">(.+)</span>(.+)</p>
and the replace field I have:
Code:
<div class="\1"><p class="\1"><span class="\1">\3</span></p><p class="\1">\4</p></div>
As a test, I went back before the first replacement and ran the "find" again. It found the same paragraph inside the div tag, which is not what I want.

I tried using the "^" in front of my search string, but this didn't stop it from finding the same p tag inside the div tag.

Any ideas? Thanks in advance.
Hi kakkalla;

In the "Find" field, try using the following chain:

Code:
<p class="list(.+)"><span class="list(.*)">(.+)</span>(.+)</p>
And in the "Replace" field, use:

Code:
<div class="list\1"><p class="list\1"><span class="list\1">\3</span></p><p class="list\1">\4</p></div>

But it makes little sense to use the same class for the <p> and <span> tags because both of them will apply the same format. In that case, the <span> code is not necessary (is redundant). You could use in the "Replace" field the following chain:

Code:
<div class="list\1"><p class="list\1">\3</p><p class="list\1">\4</p></div>
Regards
Rubén
RbnJrg is offline   Reply With Quote