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

265
Vistas
Regex to fix malformed vector

I have an API that is returning the following, malformed string:

M0 0L1.33333 0L1.33333 4L4.44089e-16 4L0 0Z

It should look like this:

M 0 0 L 1.33333 0 L 1.33333 4 L 4.44089e-16 4 L 0 0 Z

How could I write a regex that would select any letter that has a number next to it, preceding or following?

Here are the strings again, next to each other:

M0 0L1.33333 0L1.33333 4L4.44089e-16 4L0 0Z <-incorrect

M 0 0 L 1.33333 0 L 1.33333 4 L 4.44089e-16 4 L 0 0 Z <-correct

Thanks!

A little background: this is a vector returned by the Figma API and I don't know why it's formatted like that.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

something like this should work: /[A-Z]\d|\d[A-Z]/g

https://regexr.com/ really helps with testing out regexes.

here's a link to the one i've been testing on: https://regexr.com/65vu7

about 4 years ago · Juan Pablo Isaza Denunciar

0

You could use this regex here regexr.com/65vvt

([A-Z])\d|\d([A-Z])

And then check for capture group 1 or 2. That will match all the capital letters of your incorrect example string but none of your correct string.

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