With preg_match, you can use <name> and it will add that to the output array.
With preg_replace, I’d like to match a url, such as "http://<url>\s" and then have that url preserved in the replacement string, such as "beforetheurl<url>aftertheurl"
Here is an example to my comment:
Output:
beforematchedafterhttp://codepad.org/PANzOm6c