VS Code使用正则表达式舍入文件中的所有浮点数

时间:2019-01-20 01:25:36

标签: regex visual-studio-code

我不确定这是否是一个愚蠢的问题,但是我想要的是减小.svg文件的大小。 svg文件的浮点数很多,小数点很长,我想用1或2个小数点四舍五入。我通过VS Code->使用正则表达式查找和替换功能进行了尝试。如果您有类似情况的经验,请帮助我。

svg文件如下所示。

...
<path
       id="path3729"
       d="m 86.131558,7.2642257 c 0.994873,-0.720422 4.253935,1.8525207 4.76852,2.4357217 0.51459,0.5832006 1.063487,2.6415546 1.063487,2.6415546 0,0 2.984618,4.356851 4.288242,7.924671 1.303624,3.567816 1.406541,8.336338 1.406541,8.336338 l -4.459769,-1.235015 c 0,0 0.51459,-3.121836 -0.548893,-7.753137 -1.057898,-4.606977 -2.504335,-6.655351 -2.504335,-6.655351 0,0 -1.132097,-0.480281 -1.852517,-1.440849 -0.720428,-0.960565 -0.445979,-1.5780696 -0.926262,-2.4014126 -0.308755,-0.4802837 -1.029176,-0.7547307 -1.1664,-1.0634857 -0.137236,-0.308751 -0.0686,-0.789035 -0.0686,-0.789035 z"
       style="display:inline;fill:#f0bc8d;fill-opacity:1;stroke:none;stroke-width:0.09605659px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    <path
       id="path3731"
       d="m 82.323603,40.060689 c 0,0 1.337927,0.411673 2.092658,0.240153 0.754732,-0.171515 2.367111,-1.303623 2.367111,-1.303623 0,0 -0.240153,-1.063485 -0.308751,-2.332801 -0.274433,-1.097789 -0.5832,-2.298496 -0.5832,-2.298496 0,0 0.754731,-1.303627 0.857644,-3.018923 0.102917,-1.715295 0.0686,-3.224756 -0.411669,-3.842262 -0.480286,-0.617509 -1.886823,-0.994872 -3.773651,-0.857651 -1.886824,0.137224 -3.499204,0.514592 -4.013793,1.509461 -0.514586,0.994873 0.279016,4.627892 0.891955,5.454644 1.475155,1.989742 2.710169,2.298497 2.710169,2.298497 0,0 0.125796,1.383672 0.154376,2.075508 0.0287,0.691836 0.01714,2.075509 0.01714,2.075509 z"
       style="display:inline;fill:#f0bc8d;fill-opacity:1;stroke:none;stroke-width:0.09605659px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    <path
...

0 个答案:

没有答案