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.
AlanPosted Oct 3, 2008, 3:51 PM
This should work:
Regex regex = new Regex(@"^.*(?=/.*$)");
Nicolas San JuanPosted Oct 3, 2008, 4:45 PM