C# .NET - need pattern matching(regular expression)

Asked By abinav shankar on 17-Feb-12 05:24 AM
Hi
 
I need the pattern matching for the following url
 
http://test.abc.com/test/testing.aspx?businessurl=%3C?%3E&pagetype=businesshome
kalpana aparnathi replied to abinav shankar on 17-Feb-12 05:42 AM
hi,

In c# you can use regex for example as below:

Regex r = new Regex("(?<Protocol>\w+):\/\/(?<Domain>[\w@][\w.:@]+)\/?[\w\.?=%&=\-@/$,]*");
// Match the regular expression pattern against a text string.
Match m = r.Match(text);
while (m.Success)
{
   //do things with your matching text
   m = m.NextMatch();
}

Regards,