How about using the split command on the URL and use the slash ( / ) as the separator? You now have to count how many slashes are used (starting at 0).
(I want to extract sentences after"~" - #6 by akiganai)
So, maybe like:
storeEval | ${urlLine}.split("/")[4] | productCode
Note: The “split” command takes a RegEx as its parameter, so if the character you want to separate on is a RegEx character, then you need to add two \\ in front of your separator.