Answers for "javascript regex named capture group"

0

javascript regex named capture group

const auth = 'Bearer AUTHORIZATION_TOKEN'
const { groups: { token } } = /Bearer (?<token>[^ $]*)/.exec(auth)
console.log(token) // Prints "AUTHORIZATION_TOKEN"
Posted by: Guest on May-14-2020
0

named regex group JS

const auth = 'Bearer AUTHORIZATION_TOKEN'
  const { groups: { token } } = /Bearer (?<token>[^ $]*)/.exec(auth)
  console.log(token) // "Prints AUTHORIZATION_TOKEN"
Posted by: Guest on July-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language