Z
Z
ZaxapKramer2017-03-30 07:28:58
Regular Expressions
ZaxapKramer, 2017-03-30 07:28:58

Regular expression: move comma to the right (or "multiply by 10"), is that possible?

In general, there was such a need in Sublime Text: to replace one with another with a regular expression (because manually I got completely confused).
You need to multiply the numbers by 10 or just move the comma (point) to the right.
.1rem => 1rem
10rem => 100rem
1.2rem => 12rem
1.28rem => 12.8rem
And no matter what I do, nothing happens normally.
Stuck on "1.28rem", because ... after the dot there can be any number of digits, right?
How would you implement this ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
ZaxapKramer, 2017-03-30
@ZaxapKramer

As soon as I asked the question, I realized that I chose the logic that was fundamentally wrong when solving the problem.
Everything works, I'm sorry. True, 0 at the end is embarrassing, but I don’t know another solution.
from: (\d+)rem|(\d*)\.?(\d?)(\d*)rem
to:$1$2$3.$4\u0rem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question