Regular Expressions in DW CS5

Hi all,

I am trying to write a regular expression so that i can find and replace a piece of a div code.

How do you write 1, I need to find

  <div class="breadcrumbs" id="breadcrumbs" style='position:absolute; left:12.75pt; top:399pt; width:411px; height:13.5pt; z-index: 1; font-family: Verdana, Arial, Helvetica, sans-serif;' > <a href="1_2_1body.html" target="_self">1</a><a href="1_2_2body.html" target="_self">2</a></div>

with

<div class="newNav id="newNav""></div>

Href inside the divs will be changing, so the regexp should only target the class and id which is consistent

any help is appreciated.

Thanks

RG
rgarimellaAsked:
Who is Participating?
 
Jason C. LevineConnect With a Mentor No oneCommented:
While you could do it with regular expressions in DW, it's far easier to do Find and Replace on Specific Tag.  You will have to run it a couple of different times to fully get what you want, but it would work.  The first search would look like this:

 Specific Tag Find/Replace
So you can see, all we are doing is swapping the class "breadcrumbs" with the class "newNav"

The second pass would swap id "breadcrumbs" with id "newNav" and the final pass would search on id = newNav and the action would be to remove the style attribute.
0
 
mark_harris231Commented:
RG - if you want to do this with regular expression, could you clarify/give example of the desired outcome?

Original:   <div class="breadcrumbs" id="breadcrumbs" style='position:absolute; left:12.75pt; top:399pt; width:411px; height:13.5pt; z-index: 1; font-family: Verdana, Arial, Helvetica, sans-serif;' > <a href="1_2_1body.html" target="_self">1</a><a href="1_2_2body.html" target="_self">2</a></div>

Desired Result:
 ?
0
 
Terry WoodsIT GuruCommented:
Note that a regex is only going to work if you don't have other div's nested within the div tag you're trying to substitute, as in that case it would pick up the </div> tag of the nested div.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.