js regex replace capture group 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"