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

76
Vistas
Regex to match what's before or after a character in different situations

I have some troubles writing a regex

What I want to achieve, I want to match the following string 6.62 X 25.250755 L but only what is after the X character or there may be cases when I have to match the following string 25.250755 X 6.62 in this case I need to match what's before the X character and the final case is when I have something like this: 25.250755 L X 6.62 or 25.250755L X 6.62 (with or without space, with or without the L character)

This is what I have so far, but is not enough and I don't know how to continue form here on

/[Xx]([\s\S]*)$/gm
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

For your example data, you can repeat a group with a capture group to capture the value of the last iteration.

(?: ?\b(\d+(?:\.\d+)) ?[XL])+\b
  • (?: Non capture group
    • ?\b Match an optional space and a word boundary
    • ( Capture group 1
      • \d+(?:\.\d+) Match 1 or more digits with an optional decimal part
    • ) Close group 1
    • ?[XL] Match an optional space and either X or L
  • )+ Close the non capture group and repeat it 1 or more times
  • \b A word boundary

Regex demo

about 4 years ago · Juan Pablo Isaza Denunciar

0

([0-9]*[.])?[0-9]+ ?L? X ([0-9]*[.])?[0-9]+ ?L? should work.

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