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

297
Vistas
How can I get a specific word between HTML tags with Regex

Given this HTML string:

<p class="">What a <span>classy</span> man!</p>
<p class="tag">He has so much class.</p>

I'd like to use Regex to get the two instances of 'class' that are between the HTML tags (i.e. not the class attributes). Note, the word 'class' could be another word but the results must not include anything from inside the HTML tags.

I have this so far: /(?<=\>)(.*?)(?=\<)/gi which gets all text between the tags but how do I change this to look for a specific word instead?

Ultimately, my aim is to wrap instances of 'class' with a <mark> tag. i.e. I need Regex so that I can change the string to look like this:

What a classy man!

for the first line and like this: He has so much class.

for the second line.

Thanks

about 4 years ago · Juan Pablo Isaza
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