I have some site content that contains abbreviations. I have a list of recognised abbreviations for the site, along with their explanations. I want to create a regular expression which will allow me to replace all of the recognised abbreviations found in the content with some markup.
For example:
content:
This is just a little test of the memb to see if it gets picked up. Deb of course should also be caught here.
abbreviations:
memb = Member; deb = Debut;
result:
This is just a little test of the [a title="Member"]memb[/a] to see if it gets picked up. [a title="Debut"]Deb[/a] of course should also be caught here.
(This is just example markup for simplicity).
Thanks.
EDIT:
CraigD's answer is nearly there, but there are issues. I only want to match whole words. I also want to keep the correct capitalisation of each word replaced, so that deb is still deb, and Deb is still Deb as per the original text. For example, this input:
This is just a little test of the memb. And another memb, but not amemba. Deb of course should also be caught here.deb!