We have a supplier that fires an HTTP post without using query strings. Effectively they post to our application in the following format:
www.mydomain.com/ourHandler/GroupId/ProductId/ItemId/CustomerId/
ourHandler (or Tracker) and GroupId is the only guaranteed values. The rest are completely optional. The slash on the end could be missing, too. I’m told that I need to cater for “hundreds of hits a second”.
So I thought the best option might be to use a regex (which I suck at) instead of string.split.
Here’s what I got but obviously it’s not good enough:
^(?<tracker>.\w*)?/(?<GroupId>\w*)?/(?<ProductId>\w)?/(?<ItemId>\w*)?(/)?(?<CustomerId>\w*)?
Why do you need Regex? Uri class has a
Segmentsproperty