[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Regular Expressions in DW CS5

Posted on 2011-10-26
3
Medium Priority
?
414 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:rgarimella
3 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 2000 total points
ID: 37033910
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
 
LVL 10

Expert Comment

by:mark_harris231
ID: 37037308
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
 
LVL 35

Expert Comment

by:Terry Woods
ID: 37041083
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
Loops Section Overview
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month18 days, 16 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question