Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Search parameters for advanced find and replace

Explorer ,
Oct 09, 2017 Oct 09, 2017

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,

597
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 09, 2017 Oct 09, 2017

Have you tried this:

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 09, 2017 Oct 09, 2017

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 10, 2017 Oct 10, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 10, 2017 Oct 10, 2017
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 09, 2017 Oct 09, 2017

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.

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