Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

126
Visualizações
Using ?= in javascript regular expression

in javascript

console.log(/x(?=b[1-9])/.test('xb2')); // true

console.log(/x(?=b[1-9])$/.test('xb2')); // false

what is difference ?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The first pattern x(?=b[1-9]) matches x which is then followed by b and a digit. The input xb2 matches this.

The second pattern x(?=b[1-9])$ is conflicting, and can never match anything. This pattern says to match:

x           the letter x
(?=b[1-9])  assert that b and 1-9 follows
$           match end of the input

It is impossible for b[1-9] to follow x while at the same time x is the end of the input. Use the first version in your question.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda