Custom Text replacements
First a little warning: This is very advanced tuning, you need some knowlege about [[wp>Regular Expression]s and if you set up something wrong here you may break the layout or at least the XHTML compliance.
Custom text replacements are defined in the
conf/custom.conf
file. You can give a regular expression and a replacement seperated by whitespace per line. Comments (using the hash
#
character), empty lines or wrong formated lines are ignored. The regular expression has to use slashes
/
as delimiter. You can give pattern modifiers after the second delimiter. The replcacement has to be quoted with single quotes
'
.
Here is an example that replaces all occurances of the
word foo
with the word
bar
ignoring the case of
foo
maintaining the wordboundaries:
/(\b)foo(\b)/i '\1bar\2'
You should read the following chapters of the PHP manual to completly understand how this all works:
Some more hints
The custom replacements are done
after all of the other formating took place. This means:
- Your replacement will not be parsed again
- You need to quote HTML special chars if needed
- some things may not work as expected
Please consider this, too: Your replacements will be called on every parsing – the more you include the slower the page is parsed.