Sublime Forum

Is there a way to do this with regular expressions or otherwise?

#1

New user, please help

I have large project files that look something like this:

A3 Z8 A6 Z1

and I need to change them so each letter-number set is replaced by a length of either 0s or 1s, whose length is the number from that set.

For example, if ‘A’ is 0 and ‘Z’ is 1, the “A3 Z8 A6 Z1” example above would need to become

**

000 11111111 000000 1

**

Is there a way to automate this with regular expressions and find and replace, or with an available plugin?

(I am looking for a technique that does not use RegReplace and typing out each find and replace, as many of these numbers go into the hundreds)

Thank you!

0 Likes

#2

With this uncommon need, you probably have to write your own.

1 Like