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

106
Views
Regular Expression that doesn't match continuing strings but can be part of another string

I have the following strings:

inputs.test=al
inputs.test=ally^inputs.test=alNOTinputs.test=altogether
inputs.test=ally^inputs.test=alwaysNOTinputs.test=al
inputs.test=alORinputs.test=al^inputs.test=ally^ORinputs.test=al
inputs.test<=alORinputs.test!=alORinputs.test>=al^inputs.test!=ally

I'd like to replace all instances of the string inputs.test[= or != or <= or >= or NOT]al with inputs.test[= or != or <= or >= or NOT]FIXED

All while ignoring substrings after the operator (in this example, always, ally, altogether should be left alone).

inputs.test=FIXED
inputs.test=ally^inputs.test=FIXEDNOTinputs.test=altogether
inputs.test=ally^inputs.test=alwaysNOTinputs.test=FIXED
inputs.test=FIXEDORinputs.test=FIXED^inputs.test=ally^ORinputs.test=FIXED
inputs.test<=FIXEDORinputs.test!=FIXEDORinputs.test>=FIXED^inputs.test!=ally

This may be too complicated to solve with just Regex, just wondering if there is a way.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

A little factoring and well placed assertion after the 'al' would make this regex work.
Just replace with $1FIXED

/(inputs\.test(?:[!<>]?=|NOT))al(?!ly|together|ways)/g

https://regex101.com/r/CDSYuR/1

 (                             # (1 start)
    inputs \. test   
    (?:
       [!<>]? =
     | NOT
    )
 )                             # (1 end)
 al
 (?! ly | together | ways )
about 4 years ago · Juan Pablo Isaza Report
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!