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

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

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

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