Hello,
I haven't used regular expressions in a long time, but I needed them today so i built this:
This code is used so that it can match the syntax of [image: url, alt, width, height] and only url is required where the other three are optional.PHP Code:preg_match_all('{\[image:\s?(.[^,]*),?\s?(.[^,]*)?,?\s?(\d[^,]*)?,?\s?(\d*)?\]}si', $string, $images);
I had to glance through my regular expressions book to get this working. That leads me to one question. Is there something I can do to improve this?
Thanks




.*?)\]}, and then get the matched string, explode by ",".

Bookmarks