Regular expression to replace a value in query parameter
java, regex
Solution
I wouldn't actually use regex for this, but string manipulation. Search for the position of "supplyId=" in the URL, then grab everything until the end of the string or "&", whichever comes first.
If you have to use a regex, try one of these:
(?<=supplyId=)[^&]+
supplyId=([^&]+)
Make sure case sensitivity is off. If you use the second pattern, the value you want will be in capture group 1.
Problem
I get a query string from url by saying request.queryString() as - ``` supplyId=123456789b&search=true ``` I want to replace the value for "supplyId" with a new value. "supplyId" can come at any position in the query string. What would be the possible regular expression for this?