Regular Expressions kick my pants every time I try to use them. I’m using GWT’s RegExp, and I want to extract two values from the following text:
Token[cc8ikjw2-fa7b-4cd6-b6677-04b723ef41 , 2ac7ce11-14b2-4de4-bm51-c22f23ea23af]
I want to pick out the two codes and assign them to variables while ignoring the ‘Token[‘ characters.
Please help me. You are my only hope.
Just a quick solution here (obviously may not work if there are wild variations to the string format, but works for the provided example):
The actual regular expression to match the tokens in given example is:
Token\[(\S*)\s*,\s*(\S*)\], but obviously you need to escape all back slashes in a Java string.