Click to See Complete Forum and Search --> : find and replace regular expression in dremweaver


rngr19
04-18-2008, 09:49 AM
can anyone figure this out? How to use a regular expression to find and replace all of these lists with different image names:

<ul class="linklist"><li><a href="/shared/img/maps/differentimagename.jpg">View a Map</a></li></ul>

thanks!

Fang
04-18-2008, 02:20 PM
Are you looking for a dynamic solution(JavaScript) or changing them in DW?

dtm32236
04-18-2008, 03:03 PM
it sounds like he's like to do it in DW. and I'd acutally love to know this too... it could be very useful.

It would be great to find/replace: <ul class="linklist"><li><a href="*">View a Map</a></li></ul>

where * is a wildcard for any text.

I've looked this up a while ago, and got nowhere but confused.

rngr19
04-18-2008, 04:19 PM
yes dtm! I did this all the time at my old job using Note Tab pro using this function for find & replace:

<ul class="linklist"><li><a href="{\B+}">View a Map</a></li></ul>

I would substitute the non-breaking content with the {\B+}

Trying to figure this out inside Dreamweaver

IL14N4
05-06-2008, 04:24 PM
You can do a search and replace in deamweaver, with ctrl + F
once the Search and replace dialog box opens up it ask you
where you want to look(figuratively no literally)

Find in: current document (default - you can specify otherwise)
Search : source code (by default ), in the search section you can
specify if you want to look by tag or other or you can input the exact line of code you're looking for an in the find section and in the replace section
put the code you want replace it with. Leave the default checkmark on
the bottom, for you're first search until you're more familiar on how they
work and press find next, and after being found you can press replace.

After that you can try using the replace all, it searchs for all of the lines
of code that you're looking for and replaces them all.
Be cautious you don't want to use the replace all unless you're more
familiar with it, because you could accidently replace them with the wrong code, being you don't used the feature.

dtm32236
05-07-2008, 08:07 AM
Agreed that it's easy to mess up a 'replace all'...

How about using wildcards though?

It would be great to find/replace: <ul class="linklist"><li><a href="*">View a Map</a></li></ul>

where * is a wildcard for any text.

IL14N4
05-07-2008, 04:47 PM
do you me you want to strip for example just the href= "value" and
live the rest of the anchor tag intact?

Or do you mean you want to replace all the
<ul class="linklist"><li><a href="*">View a Map</a></li></ul>

even though they have a diffrent attribute value.

Both of these can be done. But I'm not sure if this is what you want.

Let me know and if this is what you're looking for. I'd gladly explain.

dtm32236
05-08-2008, 08:09 AM
this one:

Or do you mean you want to replace all the
<ul class="linklist"><li><a href="*">View a Map</a></li></ul>

even though they have a diffrent attribute value.

That would help soooo much and save a lot of time.

IL14N4
05-09-2008, 12:41 AM
Once the Find and Replace dialog box has been opened:

set this settings on the dropdown menus:
Note the ( +, -) are to add or remove more search criteria

Find in: current document(default)

Search: Specific tag, ul



Action:Remove tag and contents (or you could also select replace contents only)
in which case it'll open a space for the code you want to replace it with if any (it could be left blank)

And then continue to either find next and replace one by one
or Find All and replace all or just simply replace all

____________________________________________________________________
----------------------------------------------------------------------------------------
The thing to take away from here is that you can narrow or expand your search criteria
for replacing, removing , or striping specific tag, of their, attribute or contents.
All within the Find and replace dialog box.

dtm32236
05-09-2008, 07:54 AM
good stuff...

I never noticed the +/- buttons - I'll have to check that out.

Thanks IL14N4!