Regex.Replace only replaces start of string

Posted by Yannick Smits on Stack Overflow See other posts from Stack Overflow or by Yannick Smits
Published on 2010-04-13T22:03:34Z Indexed on 2010/04/13 22:13 UTC
Read the original article Hit count: 579

Filed under:
|
|

I'm trying to replace a friendly url pattern with a html url notation but due to lack of regex experience I can't figure out why my regex only replaces the first occurence of my pattern:

string text = "[Hotel Des Terrasses \http://flash-hotel.fr/] and [Du Phare \http://www.activehotels.com/hotel/]";
text = Regex.Replace(text, @"\[(.+)\s*\\(.+)\]", "<a href=\"$2\" target=\"_blank\">$1</a>");

How can i make the second pattern be replaced with the HTML markup too?

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex