Hi
I'm finding regular expressions in PHP a little difficult to understand, perhaps someone can advise.
What I'm trying to achieve: I run a forum, and want people to be able to make text bold or italic using a particular method which is to start the text to be formated with a bracket, and to end the text with a bracket then either i or b (i for italics, and b for bold)
For example,
(this is some text)b
Is to be regexp'd to look like:
this is some text
It needs to be with the brackets than any other methods, as I am migrating data from a large system that uses this particular setup.
What I've come up with so far is...
$dbRow->message = ereg_replace("[(]+.+[)]i","<i>\0</i>", $dbRow->message);
This leaves in the brackets though, and also the control character (in this case, the i) at the end of the text.
Also, the other problem is, that if you have a section of text to be italic, then of normal text, then more of italic, it just makes the whole lot italic.
Any ideas, anyone?