I need to match following string separated by whitespaces starting with "Token" .
Example string
Token token=12eqddsfasdsa [email protected] app_id=2312edsdas
I have tried several expressions.
^Token (\w*=[^-\s]+)
Captures only one first match.
^Token(\s\w*=[^-\s]+)+
This expression captures only last.
I need to capture
match[0] = token=12eqddsfasdsa
match[1] = [email protected]
match[2] = app_id=2312edsdas
I know there is easy way to achieve this result, but I am not experienced enough to get it.
Please help with this.
You are facing the common problem of capturing content for repeated groups, so I would use two regexes for this:
1- First to detect the line starting with
Token
pattern using this regex:2- To extract the matches you are interesting in using another regex (like yours):
You can use a code like this
Match information