Search
Other ReReplacer questions
Forum

replace 2 items

Roberto Robuffo's Avatar Roberto Robuffo
I have 2 items to replace
the first: "example"
the second: "beautiful example"

example become
<a href=" www.mywebsite.it/example.html ">example</a>

beautiful example become
<a href=" www.mywebsite.it/example.html ">beautiful example</a>

I need to insert in both items the same link exaple.html

how can I do it?

If I use two different elements first overwrite second
So I find two tags <a>

I need "replace example if isn't inside tag <a>" or something else...

Any tips?
Thank you
Peter van Westen's Avatar Peter van Westen ADMIN
There are different ways you can go about this depending on the situation and usecase.

If enough, you could simply only replace "example" if it is not directly followed by a "<" character.

Using Regular Expressions:
(beautiful example|example)([^<])
Replace with:
<a href="...">\1</a>\2
Please post a rating at the Joomla! Extensions Directory
Roberto Robuffo's Avatar Roberto Robuffo
Ok thank you for your reply
I have another situation
Sometimes the keyword is inside a panel component and all panel is linked
The Panel can contain this keyword
How can I don't set the link if there is a tag <a> as a parent
Peter van Westen's Avatar Peter van Westen ADMIN
Difficult.

Easiest way is to just do the replacements regardless of parent links.

Then with a second replacement remove any nested links.
But the syntax depends very much on how fixed and known the HTML structure around it is.
Please post a rating at the Joomla! Extensions Directory
Peter van Westen's Avatar Peter van Westen ADMIN
For the second one you can also use the 'between' fields, to search for and remove links inside certain elements.
Please post a rating at the Joomla! Extensions Directory
Roberto Robuffo's Avatar Roberto Robuffo
ok thanks for reply
for now I disabled the panel link...
😉
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription