Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

85
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda