2
Reply

Regular expression

Nicolas San Juan

Nicolas San Juan

Oct 3 2008 2:34 PM
2.1k

Hello there,

If I have a url,

 http://localhost:49573/mySite/home.aspx?id=121aad, and I am trying to return just http://localhost:49573/mySite with a regular expression. How should I do it?

Here what I got so far

Regex regex = new Regex(@"[a-zA-Z]*(?=\/*$)");

but it only strips the last part after the  = sign.

Any help would be appreciated.


Answers (2)