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

107
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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