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

118
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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