MC+A Stream

Our Blog and News Stream

Parsing a URL Encoded String for the parameter (match between two words)

December 17th, 2009

I spent the last hour trying to find a regular expression to parse a url that was url-encoded or to match between two words.  Java was having a difficult time retrieving the url since it was parameter=something& but rather proxystylesheet%3Ddefault_frontend%26.  The expression is:

(?<=proxystylesheet%3D).*?(?=%26)

Where proxystylesheet is the parameter you are looking for.  This won’t find the value if it is at the end of the line but in my case, that is unnecessary.