Search
Other DB Replacer questions
Forum

Multiple replacements on search strings.

Peter Tuson's Avatar Peter Tuson
Hello Peter,

I am trying to replace the {} with <> around div items within the content of modules.

I am successfully using (\{div class="[^\{]*"\}) to find the initial div.

But using
[[replace from="{" to="<"]] \1 [[/replace]]
[[replace from="}" to=">"]] \1 [[/replace]]

doesn't work as it creates two results. How do I combine the replace commands into a single one so that only on correct result is produced?

Regards,

Peter.
Peter van Westen's Avatar Peter van Westen ADMIN
Are you talking about DB Replacer?
DB Replacer doesn't have [[replace]] tags...
Please post a rating at the Joomla! Extensions Directory
Peter Tuson's Avatar Peter Tuson
Peter,

Sorry but in the Joomla 4 documentation on Special Tags it mentions [[replace from ...

In any case do you have any ideas on how I might change the {} to <> and the beginning and end of the div text in one go?

Or do I have to have a sequence of operation?

Regards,

Peter.
Peter van Westen's Avatar Peter van Westen ADMIN
Ah, sorry, wasn't sure what you were trying to do.

You can simply do something like:
Search (Regular Expressions):
\{(/?div(?: [^\}]*)?\}
And replace with:
<\1>
Please post a rating at the Joomla! Extensions Directory
Peter Tuson's Avatar Peter Tuson
Peter,

Thanks.

I did it using \{(\/?div[^\}]*)\} as my search code.

Regards,

Peter.
Peter van Westen's Avatar Peter van Westen ADMIN
Yup, that will work too 🙂
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