我目前有一长串代码如下:
<line fill="none" x1="555" y1="562.8181152" x2="542.1015625" y2="579.6394043"/>
<line fill="none" x1="542" y1="579.6394043" x2="527.46875" y2="594.4655762"/>
<line fill="none" x1="527.46875" y1="594.4655762" x2="504" y2="613.9626465"/>
<line fill="none" x1="504" y1="613.9626465" x2="481.9648438" y2="629.4460449"/>
<line fill="none" x1="481" y1="629.4460449" x2="461.6015625" y2="641.6647949"/>
<line fill="none" x1="461" y1="641.6647949" x2="441.1074219" y2="650.2966309"/>
<line fill="none" x1="441" y1="650.2966309" x2="424.0859375" y2="655.7995605"/>
<line fill="none" x1="424" y1="655.7995605" x2="394.5" y2="662.2321777"/>
<line fill="none" x1="394.5" y1="662.2321777" x2="368.8945313" y2="665.0407715"/>
<line fill="none" x1="368" y1="665.0407715" x2="351.0014648" y2="665.6970215"/>
<line fill="none" x1="351" y1="665.6970215" x2="332.1748047" y2="665.3688965"/>
<line fill="none" x1="332" y1="665.3688965" x2="311.1508789" y2="662.2321777"/>
<line fill="none" x1="311" y1="662.2321777" x2="287.7905273" y2="655.7995605"/>
<line fill="none" x1="287" y1="655.7995605" x2="267.5742188" y2="648.2351074"/>
<line fill="none" x1="267" y1="648.2351074" x2="243.965332" y2="636.6647949"/>
<line fill="none" x1="243.965332" y1="636.6647949" x2="216.9702148" y2="619.0388184"/>
<line fill="none" x1="216" y1="619.0388184" x2="194.0844727" y2="599.3747559"/>
<line fill="none" x1="194" y1="599.3747559" x2="171.9951172" y2="574.7194824"/>
<line fill="none" x1="171" y1="574.7194824" x2="153.3139648" y2="547.5153809"/>
<line fill="none" x1="153" y1="547.5153809" x2="137.4921875" y2="517.0036621"/>
由于这在移动设备上呈现为 svg,因此需要删除小数位,例如
<line fill="none" x1="153" y1="547" x2="137" y2="517"/>
代替
<line fill="none" x1="153" y1="547.5153809" x2="137.4921875" y2="517.0036621"/>
我知道这可以通过正则表达式实现,但是我在不同的示例中查看了 stackoverflow,但始终无法理解正则表达式。任何帮助表示赞赏!