Highlighted

Search parameters for advanced find and replace

Explorer ,
Oct 09, 2017

Copy link to clipboard

Copied

I'm struggling with Dw Advanced Find and Replace.

Essentially - I have:

<div class="scheme1">

<img src ..... >

</div>

...that's located in 100s of files on a website. I want to find every "img src" and replace it with "img class="imgclass" src" - ONLY when it appears inside a div with the class set to "scheme1." Is this possible? I've tried with several find and replace parameters and I'm getting "none found" - anyone know what I might be doing wrong? I can post a screenshot if this isn't clear.

Thanks,

Views

443

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Search parameters for advanced find and replace

Explorer ,
Oct 09, 2017

Copy link to clipboard

Copied

I'm struggling with Dw Advanced Find and Replace.

Essentially - I have:

<div class="scheme1">

<img src ..... >

</div>

...that's located in 100s of files on a website. I want to find every "img src" and replace it with "img class="imgclass" src" - ONLY when it appears inside a div with the class set to "scheme1." Is this possible? I've tried with several find and replace parameters and I'm getting "none found" - anyone know what I might be doing wrong? I can post a screenshot if this isn't clear.

Thanks,

Views

444

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 09, 2017 0
Adobe Community Professional ,
Oct 09, 2017

Copy link to clipboard

Copied

Have you tried this:

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 09, 2017 0
Explorer ,
Oct 09, 2017

Copy link to clipboard

Copied

No, i was trying to do it as a text find-replace. I'll try that later tonight when I'm back up on my Dw enabled machine. Thanks

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 09, 2017 0
Explorer ,
Oct 10, 2017

Copy link to clipboard

Copied

Tried the above suggestion, "Done. None found in 1 document." Sad

EDIT: Find in "current document - any tag" works - but then the replace action wants to change the div class, not the img class.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 10, 2017 0
Adobe Community Professional ,
Oct 10, 2017

Copy link to clipboard

Copied

If you copied exactly what I show in the screen shot, it would mean the description of what you need and what you actually need are slightly different from each other.

Could you post a link to one of your pages so we can see the full code?

Like I mention above, it's probably going to be better (and easier) to just write a css selector for this than to modify every page using F&R.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 10, 2017 1
Adobe Community Professional ,
Oct 09, 2017

Copy link to clipboard

Copied

It might be easier (and less likely to blow up if not exactly right) to target the <img> tag using a css selector rather than trying to add a class to it in the html. Something like...

.scheme1 img {

     property:value;

     property;value;

}

...in your stylesheet may do the trick, with the added benefit of not needing to save/re-upload/overwrite every page that changes, just the single .css file.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 09, 2017 2