Hello there,

In my effort to make the tutorial updateable, I decided to get rid
from some of the horrendous formatting which was made by word when I
first started the tutorial. I concluded that updating this by hand
isn't the way to go, so I decided to use regular expressions but I am
faced with a problem (it may be really simple though because I've
never really used RegEx seriously before).


Accross the tutorial, there are scattered paragraphs of text like
this:

  <br>
  <p class=SCCorrect><span class=FSCComment> ; Debug the text</span></p>
  <p class=SCCorrect><span class=FSCComment> ; hello there</span></p>
  <p class=SCCorrect><span class=FSCCmd>&nbsp;</span></p>
  <p class=SCCorrect><span class=FSCCmd>Win.Debug(</span>&quot;<span 
class="FSCCmdVal">hello 
    there</span>&quot;<span class="FSCCmd">)</span></p>
  <br>

This is the format currently used for script sections, which
dreamwaver cannot display correctly. I am thinking of converting it to
something like this:

<br>
<div class=SCCorrect>
     <span class=FSCComment> ; Debug the text</span><br>
     <span class=FSCComment> ; hello there</span><br>
     <span class=FSCCmd>&nbsp;</span><br>
     <span class=FSCCmd>Win.Debug(</span>&quot;<span class="FSCCmdVal">hello
           there</span>&quot;<span class="FSCCmd">)</span>
</div>
<br>

which although still complex because of the many spans (for syntax
coloring) is much more readable and will display finally correctly in
WYSIWYG editors so we can update it really easily (even beginners).

To do what I described, I first want to select the initial <p>
occurence and last </p> occurence to add the <div></div> tags. After
that, I will start cleaning up the paragraphs within. My problem is
adding the <div> tags. I have written the following RegEx:

(<p class=SCCorrect>[\s\S]*?</p>)

This however, selects each individual line separately and makes me
unable to achieve what I want, since I want to select all subsequent
occurrences of this expression. Turning greed on doesn't really help
since it also selects the texts that are between scripts. What is the
solution?


-- 
Best regards,
 Alexander Cicovic

http://www.alexcicovic.com/

Reply via email to