I have the following code and the regular expression I am currently using does not appear to be catching any url I enter in standard format (www.google.com) as when it is displayed in a listbox, the URL is still there. Does anyone know where I'm going wrong?
e1.MessageBody = txtMessage.Text;
Regex.Replace(e1.MessageBody, @"/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/", ""string.Empty);
www.google.comis displayed really doesn't explain the issue.. perhaps you could use the string.Replace along with theUri.QueryorUriClass you split and replace.. not understanding your questionRegex.Replaceto anything and""string.Emptyis an invalid parameter.