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.

AlanRank #669 · 3.6K reputationPosted Oct 3, 2008, 11:51 AM EDT
This should work:
Regex regex = new Regex(@"^.*(?=/.*$)");
Nicolas San Juan5 reputationPosted Oct 3, 2008, 12:45 PM EDT