Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!