I developed something similar, but I had problems with the preg functions and the square brackets ([,]). I ended up using the angle braces (<,>) to set apart the url designations.
Something like: <http://someurl.com>
Since I wasn't allowing any html, it wasn't a problem.