Formatting a URL in Regular Expression when URL has variability
Description:
Often times web stores or other dynamically generated content will have randomized URLs. This can be an issue for the Credit Card and License Scanning solutions. You can account for this variability by properly formatting your Regular Expression string.
Solution:
Adding .+ will match against any length string.
Example 1:
The string a.+ple will match the following:
apple
apppppple
amybalognahasafirstnameple
aple
Example 2:
In the below URL, the emboldened portions were variable.
https://checkout.globalgatewaye4.firstdata.com/payment/collect_payment_amount?merchant=WSP-FIRST-0EWWUgCO4Q&order=f6c47af79751c3e8ede134e8ab839b4ae82bd365e10622ea8cbe2fbce245af57&t=2
We accounted for the variability like so:
https://checkout.globalgatewaye4.firstdata.com/payment/collect_payment_amount?merchant=.+&order=.+&t=.+
Note: that the rest of the string must formatted for proper RegEx syntax