Hey all - going through the Jammming project I’ve reached step 79 where we need to use a regular expression in order to match access tokens to hook into Spotify’s API.
My question is, can anyone break down what this particular regular expression is looking for? I’ve done some research on RegExp formatting and have a general understanding, but some of these characters are confusing given the context. Here’s some code:
const accessToken = window.location.href.match(/access_token=([^&]*)/); const expiresInMatch = window.location.href.match(/expires_in=([^&]*)/);
Based on that url - I can’t fathom how someone would even know what RegExp to use given that most of the token is hidden, and I’m not seeing characters in the Regular Expression that match in the url to use in the
I watched through the help video on this section, and even the narrattor glosses over this particular task himself without much explanation as to how and why we’re using this particular Regular Expression. Can anyone enlighten me?