P
P
pontiac3582018-08-18 17:06:42
Regular Expressions
pontiac358, 2018-08-18 17:06:42

How to replace a number using regular expressions?

There are styles, you need to divide all values ​​in rem by 10, for example

.btn{
  height: 40rem;
  border-radius: 20rem;	
  font-size: 18rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0 25rem;
  }

should work
.btn{
  height: 4rem;
  border-radius: 2rem;	
  font-size: 1.8rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0 2.5rem;
  }

the styles are very large so it will take a very long time to manually

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2018-08-18
@pontiac358

Regular expressions can find and replace text, but they cannot divide.
so you have to script. for example, so .

V
vreitech, 2018-08-19
@fzfx

for example like this:

#!/usr/bin/perl
($_='some text with numbers 10, 6, 7, 2.5 and nothing more')=~s~([.\d]+)~$1*++$?~ge;print

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question