Hiya fellow PHP coders!
I have a problem. I need a function to parse mIRC-colorcodes with PHP. Unfortunaly, I'm not capable to do this myself (or I'm thinking too advanced or something).
The code is built like this; chr(3) starts the color formating. After that sign, a series of numbers will come. Can be one or two digits (1-15). 0-9 can have an additional zero before it, like 00-09. Each of these number represents a color.
[ snip ]
Now, to make it even worse, it's possible to use a background-color for the text. This is added with a coma. So, the syntax is "X4,8String" where X is really chr(3). Red (4) String with yellow (8) background.
I'm not a regex guru, but |[0-9]{2},[0-9]{2}(*.?)| should capture it. I forget how to ask the regex for optional items, but that should get you started.
-- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php