What platform are you on? PHP provides preg_replace(), and .NET's RegularExpressions namespace has a MatchEvaluator class that allows you to programmatically handle the replacement. You want to do two entirely unrelated things to the match: HTML-encode it (just spaces?!?), and enclose it in a URL as in your example. No one expression is going to do that for you. If what's inside the parentheses is the match, then that's what the expression will return; you can't also find all the spaces (of which there could be any number, at any location) and replace them with '+' in a single step. I'd be shocked to learn that PHP didn't provide an HTML-encode function that you could invoke within your replacement function. You could also encode spaces by means of a second regex, from within the above replacement function, but that would be unconscionably cute if the platform already provided a way to do it.
"Some day, and that day may never come, I will call upon you to do a service for me." — Don Vito Corleone