This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > March 2005 > Find/Replace feature





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Find/Replace feature
Adrian Stock

2005-03-30, 7:36 am

Hi,

I use DW MX 2004.

I think I am asking the impossible, but have at least to try, just in
case there is an easy answer.

I have several sites with a lot of messy code to tidy up. Some of it I
do one by one, some by find/replace through the whole site.

Right now I have to remove a large number of
<div align="right"> and its end tag, leaving whatever is in between
untouched.

Thus I am turning
<td><div align="right"> (something else) </div></td>
into
<td>(something else)</td>

Getting rid of the opening is no problem, but if I do it 'automatically'
there is the problem of finding the 'loose end' </div>. So I feel I have
to remove opening and closing tag at the same time, by hand, one by one.


Is there, in Find/Replace, a way of getting rid not only of
<div align="right">
but also of the associated
</div>
?

I think it cannot be done, but am asking, just in case.

NB. I must not make a mistake with divisions since a loose start <div>
or end </div> can stop the template from working and lose a lot of
unsaved work when the template goes on strike.

Thanks for any comments.

Adrian
(_seb_)

2005-03-30, 7:36 am

Adrian, in case you wouldn't know, Mick is using a 'regular expression'.
Dreamweaver find and replace feature supports regular expressions, which
are a way to do just what you are talking about (find things with other
things in between them and replace only what matches but not what is
between the matches)

To know more about regular expression, visit
http://www.regular-expressions.info/
this is the best reference I know about regular expressions (or 'regex')
very useful

Mick White wrote:
> Adrian Stock wrote:
>
>
>
> find: <div align="right">([^<]*)<\/div>
>
> replace with: $1
>
> Note this works only with div's that don't contain <othertags>.
>
> Mick


--
sebATwebtrans1DOTcom | http://webtrans1.com | creative web designs
(_seb_)

2005-03-30, 7:36 am

Adrian, in case you wouldn't know, Mick is using a 'regular expression'.
Dreamweaver find and replace feature supports regular expressions, which
are a way to do just what you are talking about (find things with other
things in between them and replace only what matches but not what is
between the matches)

To know more about regular expression, visit
http://www.regular-expressions.info/
this is the best reference I know about regular expressions (or 'regex')
very useful

Adrian Stock wrote:
> Mick White wrote:
>
>
>
> Thanks, this is great. Where can I find out more about this notation
> and its possibilities?
>
> Adrian


--
sebATwebtrans1DOTcom | http://webtrans1.com | creative web designs
Adrian Stock

2005-03-30, 7:36 am

Mick White wrote:

>
>
> find: <div align="right">([^<]*)<\/div>
>
> replace with: $1
>
> Note this works only with div's that don't contain <othertags>.
>
> Mick


Thanks, this is great. Where can I find out more about this notation
and its possibilities?

Adrian
Adrian Stock

2005-03-30, 7:36 am

Kitzzy wrote:

> If you are just trying to strip a tag (open and close) and leave all the
> content intact you should be able to use the 'Specific Tag' Find and Replace.
> When you open the Find and Replace window, in the 'Search' drop-down select
> 'Specific Tag' The window will change and there you can select the tag you want
> and even set attributes it must have then from the 'Action' drop-down select
> 'Strip Tag'. Hope that helps.
>


Hi Kitzzy and _seb_,

very useful now, and promising for my future work.

Thanks,

Adrian
Adrian Stock

2005-03-30, 7:37 am

Bonnie wrote:
> Adrian Stock wrote:
>
>
>
> Adrian,
>
> You should know, too, that if you happen to create a very extremely
> useful search/replace string, you can save it to a file, re-use, and
> edit it. Look for the little picture of the floppy disk in the
> Find/Replace dialogue box.
>
>


Thank you, Bonnie, for that tip. There is a hell of a lot of stuff to
be explored, as I now see, in that seemingly simple feature
(Find/Replace). No end of pleasant surprises.

Happy Easter to all of you!

Adrian
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews