Reputation: 4443
How can I delete with regex from URL (string)
http://test.com/org/category,1/2
, this part:
/2
or /2/
, with C# language
Of course, there will be numbers like category,1/412/
, category,1/521
, category,1/infinity..
How can I do this with regex?
Upvotes: 0
Views: 398
Reputation: 33908
It seems that you want to replace /\d+/?$
with empty string.
You could do that with:
url = Regex.Replace(url, @"/\d+/?$", "");
Upvotes: 4