Sample text =
legacycard.ashx?save=false&iNo=3&No=555
Sample pattern =
^legacycard.ashx(.*)No=(\d+)
Want to grab group #2 value of “555” (the value of “No=” in the sample text)
In Expresso, this works, but in ASP.NET UrlRewrite, it is not catching.
Am I missing something?
Thanks!
I would do something along these lines:
The
\?will escape the question mark that normally separates the URL and the parameters, then you make sure that it will capture every parameter key/value pair (anything that ends on&) before the parameter you actually care about. Using?:lets you specify that the set of brackets is non capturing (I’m assuming you won’t need any of the data, has the potential to slightly speeds up your regex) and leaves you just555captured. The added benefit of this approach is that it’ll work regardless of parameter order.