2
Answers

Regular expression

Nicolas San Juan

Nicolas San Juan

16y
2.1k
1

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)