ReReplacer

Looking for some ReReplace magic!

8 months 1 week ago #77284

Alex Block's Avatar Alex Block

I'm trying to figure out how I can use ReReplacer to change the following:

<td class="crm-image_URL">https://www.example.org/index.php?option=com_civicrm&amp;task=civicrm/contact/imagefile&amp;photo=cb_orglogo_908_57687d35359b6_2af216ed83332048779ed3b2a1ee9d1e.png</td>

to
<td class="crm-image_URL"><img scr="https://www.example.org/index.php?option=com_civicrm&amp;task=civicrm/contact/imagefile&amp;photo=cb_orglogo_908_57687d35359b6_2af216ed83332048779ed3b2a1ee9d1e.png"></td>

Any idea how (can??) this be done with ReReplacer?

8 months 1 week ago #77285

Peter van Westen's Avatar Peter van Westen Admin

Search (Regular Expressions):

<td class="crm-image_URL">(http[^\s]*\.png)</td>
Replace:
<td class="crm-image_URL"><img src="\1"></td>

8 months 1 week ago #77286

Alex Block's Avatar Alex Block

Wow, thanks for the quick, response! You have totally made my day! Thank you :-)

7 months 4 weeks ago #77545

Alex Block's Avatar Alex Block

Hoping maybe you have a moment to help with a variant of this...

I now need to replace:

<td class="crm-image_URL">https://www.example.org/index.php?option=com_civicrm&task=civicrm/contact/imagefile&photo=image1.png</td>
with
<td class="crm-image_URL"><img src="https://www.example.org/media/civicrm/public_images/image1.png"></td>
where of course image1.png varies.

7 months 4 weeks ago #77546

Peter van Westen's Avatar Peter van Westen Admin

Search (Regular Expressions):

<td class="crm-image_URL">http[^\s]*photo=([^\s]*\.png)</td>
Replace:
<td class="crm-image_URL"><img src="https://www.example.org/media/civicrm/public_images/\1"></td>
This should be enough to give you an idea of the basics.
If you need more and more complicated stuff, I advise you to start learning Regular Expressions.
A great place to start is:
www.regular-expressions.info/reference.html