This is a super simple version tested only on the string you gave, so I am not prmosing this is a catch all anything here...
$str = "<img src=\"style_emoticons/<#EMO_DIR#>/angry017.gif\" style=\"vertical-align:middle\" emoid=\":angry017:\" border=\"0\" alt=\"angry017.gif\" />";
preg_match_all($pttrn,$str,$theMatches);
var_dump($theMatches);
?>
Here is my super-simple one, but it assumes the smiley will be a gif.
You'll need () around each of the matching bits won't you?
$str = "<img src=\"style_emoticons/<#EMO_DIR#>/angry017.gif\" style=\"vertical-align:middle\" emoid=\":angry017:\" border=\"0\" alt=\"angry017.gif\" />";
preg_match_all($pttrn,$str,$theMatches);
var_dump($theMatches);
?>
This should work for any extension (as Jim's does, since I started from his). But it should return the bits you want as separate match items due to the use of the ().
I've been hard at work the past month or so updating SMF's IPB2 converter so it will work with IPB 2.1, and am almost finished with it. The converter uses preg_replace and a couple of arrays to replace IPB's code with the appropriate bbcode tag - the first array contains the pattern syntax to match the various things, and the second array contains the corresponding bbcode tag (for example, <!--coloro:blue--><span style="color:blue"><!--/coloro--> gets replaced with [color]). However, I'm having trouble matching the smilie code. I've already tried modifying the pattern syntax for images, and no matter what I try, nothing seems to work.
Here's an example of what I need to match:
Having recently deleted my XP-powered virtual machine in favor of one powered by Linux (Fedora Core 5), I was eager to test out the KRegExp Editor that comes with the kdewebdev package, so I tried building the pattern with that, and even that didn't work.
Can anyone help me out here? I've got several people eagerly awaiting this converter and would like to get it done soon...
Michael "Oldiesmann" Eshom
SMF Webmaster