const auth = 'Bearer AUTHORIZATION_TOKEN' const { groups: { token } } = /Bearer (?<token>[^ $]*)/.exec(auth) console.log(token) // "Prints AUTHORIZATION_TOKEN"