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

437
Visualizações
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 à 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