HighDots Forums  

regular expression in specific tag

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss regular expression in specific tag in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andy Williams webforumsuser@macromedia.com
 
Posts: n/a

Default regular expression in specific tag - 01-25-2004 , 01:07 PM






I have pages that link to <whatever path>/spacer.gif however <whatever path> doesn't exist. I also have multiple spacer.gif files on my site, located in various directories. I am trying to consolidate them to all point to the same spacer.gif file.

I've been using the specific tag feature of find and replace, hoping I can replace the src attribute value. I've tried various regular expressions \w* - * - etc but no luck. I just can't get it to find any spacer.gif in the src attribute. I plan to replace directory by directory so I can keep the '../../' part of the path correct.

help...?

Andy



Reply With Quote
  #2  
Old   
~Angela, TMM
 
Posts: n/a

Default Re: regular expression in specific tag - 01-25-2004 , 02:28 PM






Hello Andy,

First back up everything. :-)

Try this for your Regular Expression: [\w\.\/]*spacer.gif. Do a Find Next

Once you find one instance, select it in Design view. Next choose Site>
Change Link Site Wide. The current path will appear in the top field. In the
bottom field, enter /spacer.gif (or other root relative path). Click OK and
Dreamweaver will take care of all the ../ paths.

Continue doing Find Next and Change Link Site Wide until you've got all
instances. That will be quicker and easier than opening so many files.

Good luck,
~Angela

--
Angela C. Buraglia, Founder:
~FAQs, Tutorials & Resources~ http://www.DreamweaverFAQ.com
~My Extensions~ http://www.dwfaq.com/go.asp?ID=AngelaX10
DWfaq Support Newsgroup: news://support.dwfaq.com/support

Co-Author with Joseph Lowery, Dreamweaver MX 2004 Killer Tips:
http://www.dwkillertips.com

Extension Developer for Cartweaver 2:
http://www.cartweaver.com/extensionsuite.cfm

Remove the CAPS in my E-mail to reply off list.


"Andy Williams" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
I have pages that link to <whatever path>/spacer.gif however <whatever
path> doesn't exist. I also have multiple spacer.gif files on my site,
located in various directories. I am trying to consolidate them to all point
to the same spacer.gif file.
Quote:
I've been using the specific tag feature of find and replace, hoping I can
replace the src attribute value. I've tried various regular expressions
\w* - * - etc but no luck. I just can't get it to find any spacer.gif in the
src attribute. I plan to replace directory by directory so I can keep the
'../../' part of the path correct.
Quote:
help...?

Andy





Reply With Quote
  #3  
Old   
Andy Williams webforumsuser@macromedia.com
 
Posts: n/a

Default Re: regular expression in specific tag - 01-25-2004 , 04:13 PM



This sounds like a great solution!

I'm runing into a problem however.

1. when I select the image in design view it doesn't automatically put the src into the replace site wide dialog - no big deal cut and paste works

2. the problem - I keep receiving the message that both links must be of the same type (site or document ) Appearently all of my links are document relative, not site root relative. Do you know how to solve this?

Question: I've just always used document relative should I use site root relative instead, or is it just a matter of preference? My site is based on templates.



Reply With Quote
  #4  
Old   
Andy Williams webforumsuser@macromedia.com
 
Posts: n/a

Default Re: regular expression in specific tag - 01-25-2004 , 04:16 PM



woops

#2. I mean both links must either be absolute or root relative - my links are document relative



Reply With Quote
  #5  
Old   
~Angela, TMM
 
Posts: n/a

Default Re: regular expression in specific tag - 01-25-2004 , 04:43 PM



Hi Andy,

Weird, it looks like it will only populate the field if you do it on an
unsaved document. What I did was drag the image onto the page and with it
still selected, I a did Site> Change Links Sitewide.

If you point to where the file is in the site as root relative, and then
point to where you want it as root relative, Dreamweaver will take care of
the paths keeping them document relative -- at least in my test.

I had this in my file:
<img src="assets/up.gif" width="8" height="12" />

The Change all links to field read: /ng/assets/images/up.gif

I then entered this in the Into links to field: /ng/up.gif

The replaced tag became:
<img src="../up.gif" width="8" height="12" />

Which is exactly what I'd expect. Again, please back up before doing
sitewide changes in case something goes wrong. Hope that clears it up for
you!

Good luck,
~Angela
--
Angela C. Buraglia, Founder:
~FAQs, Tutorials & Resources~ http://www.DreamweaverFAQ.com
~My Extensions~ http://www.dwfaq.com/go.asp?ID=AngelaX10
DWfaq Support Newsgroup: news://support.dwfaq.com/support

Co-Author with Joseph Lowery, Dreamweaver MX 2004 Killer Tips:
http://www.dwkillertips.com

Extension Developer for Cartweaver 2:
http://www.cartweaver.com/extensionsuite.cfm

Remove the CAPS in my E-mail to reply off list.

"Andy Williams" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
woops

#2. I mean both links must either be absolute or root relative - my links
are document relative





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.