Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

435
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!