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

436
Vistas
How to exclude some word in regexp in javascript to replace string

I want to select all number from string but exclude h1 and color:#b40000 and color:#0000b4 and color:#00b400.

Example

<h1 style="color:#b40000">【Level: LV1 (1/100)】</h1>
<h1 style="color:#0000b4">【Level: LV2 (1/500)】</h1>
<h1 style="color:#00b400">【Level: LV3 (1/1000)】</h1>
【Attributes: Strength 2, Toughness 2, Wisdom 2, Spirit 2, Agility 2, Charisma 2, Luck 2. Evaluation: 2 】

I tried this

/(\d[^>|(color:#b40000)|(color:#0000b4)|(color:#00b400)|h(?!1)]|[^>|(color:#b40000)|(color:#0000b4)|(color:#00b400)|h(?!1)])(\d+)/g

but i get V1 instead of 1 and 1/100 instead 1 and 100 (i don't want '/' in 1/100)

This is my test script https://regexr.com/6i8k0 enter image description here

Please tell me how to make it become like this enter image description here

EDIT: I mean, please correct my script in https://regexr.com/6i8k0 to become like in screenshot 2. EDIT 2: I mean not HTML but string like this

h1 b40000【Level: LV1 (1/100)】h1
h1 0000b4【Level: LV2 (1/500)】h1
h1 00b400【Level: LV3 (1/1000)】h1
【Attributes: Strength 2, Toughness 2, Wisdom 2, Spirit 2, Agility 2, Charisma 2, Luck 2. Evaluation: 2】

i want to selete all digit from this example string to replace with something but i want to exclude digit 1 from h1, b40000, 0000b4, 00b400(if i use \d it'll include digit 1 from h1 and other) i don't know how to filter this, please teach me I'm new in regex so if you use https://regexr.com/ to teach it'll be earier for me to understand sorry for my bad in english thanks you

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