when writing Mini Program, I sometimes accidentally write the unit as px
. But it is well known that Mini Program generally uses rpx
as the adaptation unit.
then leads to the idea that you want to use the regular pattern of vscode
and use foresight to judge the replacement.
Analysis:
uses px
units usually preceded by numbers (\ d
), so should I just judge that there is a number in front of the match (\ d
), followed by px
?
or the matching letter px
is not preceded by r
.
the imaginary effect should be to use regular, insert a r
before px, such as 100px
= > 100rpx
;
tried to use regular matching, due to the lack of experience, did not write the correct regular, would like to ask dalao how to write?