use capture group javascript regex code example
Example: javascript regex named capture group
const auth = 'Bearer AUTHORIZATION_TOKEN'
const { groups: { token } } = /Bearer (?<token>[^ $]*)/.exec(auth)
console.log(token) // Prints "AUTHORIZATION_TOKEN"