Search
Other ReReplacer questions
Forum

Regular Expression to find duplicates

Jacob Hodara's Avatar Jacob Hodara
Hello Everyone, looking for regular expression in Joomla re replacer help to find duplicate words in P tag. example in Paragraph finding test Joomla matchcase. Tried below it worked partially
<p>(.*?)test 365(.*?)<\/p>
it worked to find only for first entry of test 365 in P tag not after.


Thank you
Peter van Westen's Avatar Peter van Westen ADMIN
It is pretty complex to search for duplicates inside certain tags.

You can try this:
<p>((?:(?!<\/p>).)*?\Ktest 365(?:(?!<\/p>).)*?)test 365(.*?)<\/p>
Replace:
$1something else$2
Please post a rating at the Joomla! Extensions Directory
Jacob Hodara's Avatar Jacob Hodara
Hi Peter
tried above as well similar problem it skipping the first entries and only match at end of p tag.
added an example here regex101.com/r/jFThBC/1
if you could have look and help to find solution.

Thank you
Peter van Westen's Avatar Peter van Westen ADMIN
What exactly are you trying to achieve as an end result?
Can you give some examples of a before and after situation?
What are you trying to replace things with?

So if the original is this:
<p>... test 365 ...</p>
<p>... test 365 ... test 365 ...</p>
<p>... test 365 ... test 365 ... test 365 ...</p>
Please post a rating at the Joomla! Extensions Directory
Jacob Hodara's Avatar Jacob Hodara
Hi Peter
have multiple words in P tag in a Joomla article would like to replace them with a link.
test 365
replace it with href around test 365 via re replacer. Only test 365 inside P tag in body.
Peter van Westen's Avatar Peter van Westen ADMIN
Try:
<p>((?:.*?[^>])?)(test 365)(.*?)<\/p>
And replace with:
$1<a href="...">$2</a>$3
And switch on the "Thorough" setting.
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription