While I was working on Improving Facebook Integration for Social Paster, I was getting in response for an api call, a plain string containing access token. The string looked something like
In order to fetch values of access_token and expires I decided to use regex. All I needed to do was
var regex *regexp.Regexp regex, err = regexp.Compile(`access_token=([^&]+)(?:&expires=(.*))?`) matches := regex.FindStringSubmatch(responseString) accessToken := matches expires := matches
I got my accessToken and expires values rather easily!
Update : For a better solution to this Problem see comment
For more details on regex package in golang refer here~~ Whizdumb ~~
Email : firstname.lastname@example.org