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

88
Visualizações
react Regex for value after colon in dom

I'm trying to write a test for the presence of text after a certain value in my html document:

<span>Dog facts: something</span>

I want to test for the presence of text after the pattern "Dog facts:" to not be null

It should be noted the value after Dog facts: changes so I can't assert on a specific value I just need to make sure that there exists text after the colon.

I am not sure if regex is what I want but I tried doing this:

test('renders dog facts', () => {
  render(<App />);
  const linkElement = screen.getByText(/Dog facts:/i);
  expect(linkElement).toBeInTheDocument();
});

but this always returns true no matter whats after the colon

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

0

If you want to only match for a letter after the dog facts you can use this.

/Dog Facts: \w/g
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