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

207
Visualizações
JavaScript regex check line break

I get information from a database that includes Locker code and is dependent on the orderId. Some orders have a Locker code, which is used to unlock the door when customers pick up their orders from locker storage.

If the locker exist then it will show in UI like this:

Locker code: // this is one html div


123456 // and the code is in another div which is string

I used regex to test the locker code in E2E testing. That regex will match the string "Locker code" and six digits . For that regex match I did like this expect(body).toMatch(/Locker code: [\r\n]+ \[A-Z0-9]+/). But seems like regex match does not work. I believe it is due to the "Locker code" and the use of a 6-digit number string in two different divs. But I can't say I'm certain. Is there any better way I can test "Locker code" and six digits?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use this regex to

^.*?Lokerokoodisi on:.*?\d{6}.*$

See the regex demo

expect(body).toMatch(/^.*?Lokerokoodisi on:.*?\d{6}.*$/)
about 4 years ago · Juan Pablo Isaza 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