The PRO version of DB Replacer also supports the use of Regular Expressions to search and replace.
This gives you great power to search for dynamic values and use (parts of) the searched text in the replacement.
For example, if you want to make all prices with syntax $123.00 bold, you can search for:
(\$[0-9]+\.[0-9][0-9])
And replace with:
<strong>\1</strong>
This will make $1.00 and $999.00 bold, but ignore $1 and $999.
When the Regular Expressions option is checked, you will also be able to search in UTF-8 mode. This can help you when using special characters or certain character sets.
More on Regular Expressions
For help and documentation on regular expressions, ReReplacer comes with a Regular Expressions Cheat Sheet.
For more info on Regular Expressions: http://www.regular-expressions.info/reference.html
For testing them: http://gskinner.com/RegExr, http://regexpal.com, http://www.phpliveregex.com
Special Tags J4
As a new Joomla 4 feature, the Pro version of DB Replacer also comes with a couple of special tags that you can use in replacements when outputting groups captured by Regular Expressions.
In the "Replace" field you can use any of the following syntaxes to achieve your desired effect:
Input Syntax | Description | Output Example |
---|---|---|
[[uppercase]]\1[[/uppercase]] | Convert text within tags to uppercase. | "IT'S A STRING!" |
[[lowercase]]\1[[/lowercase]] | Convert text within tags to lowercase. | "it's a string!" |
[[notags]]\1[[/notags]] | Remove HTML tags from the text within tags. | "It's a string!" |
[[nowhitespace]]\1[[/nowhitespace]] | Remove HTML tags and whitespace from the text within tags. | "It'sastring!" |
[[toalias]]\1[[/toalias]] | Convert text within tags to an alias (lowercase dash-separated string). | its-a-string |
[[escape]]\1[[/escape]] | Use to escape dynamic values (add slashes to quotes). | "It\'s a string!" |
[[replace from="string" to="different word"]]\1[[/replace]] | Search and replace inside the text within tags | "It's a different word!" |