Reputation:
I need to parse a string, such as /a/b/c/d=uno/c=duo.html
into three groups, such as
The parsing rules are:
My problem with the following regex (?.+/)?(?d=([^/]+)/)?(?c=(?.*)) is that I don't know how to stop the group when it encounters "d=".
Any help will be appreciated.
Thanks.
Upvotes: 0
Views: 8157
Reputation: 204289
Is the string you need to parse in the form you supplied, or is it an actual URL with parameters? If it's a URL, you can use System.Web.HttpUtility.ParseQueryString to extract a NameValueCollection containing each parameter and its value.
I've found this useful even in Windows Forms (eg parsing query parameters in ClickOnce deployed applications).
Upvotes: 8