Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

named regex group JS

  const auth = 'Bearer AUTHORIZATION_TOKEN'
  const { groups: { token } } = /Bearer (?<token>[^ $]*)/.exec(auth)
  console.log(token) // "Prints AUTHORIZATION_TOKEN"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #named #regex #group #JS
ADD COMMENT
Topic
Name
3+4 =