[英]Regex to find and replace a comma inside of fixed tags and changing numbers with notepad++
there is a XML-File with a comma instead of a point inside a specific tag.有一个带有逗号而不是特定标记内的点的 XML 文件。
So for example this Tag: <UPAvg>126,502</UPAvg>
should be <UPAvg>126.502</UPAvg>
因此,例如这个标签: <UPAvg>126,502</UPAvg>
应该是<UPAvg>126.502</UPAvg>
or <UPAvg>90,31</UPAvg>
should be <UPAvg>90.31</UPAvg>
或<UPAvg>90,31</UPAvg>
应该是<UPAvg>90.31</UPAvg>
so only the comma in this specific tag should be turned into a point.所以只有这个特定标签中的逗号应该变成一个点。 The numbers are changing, so I tried to only search for the comma and replace it with the point inside this tag.数字在变化,所以我尝试只搜索逗号并将其替换为该标签内的点。 But I can't get it.但我无法得到它。 Can anybody help me?有谁能够帮我?
Find this: ,(?=\d*</UPAvg)
找到这个: ,(?=\d*</UPAvg)
Repleace with this .
用这个替换.
,
Find , ,
查找,?=
lookahead, when, is found the regex engine should check to see what is after (ahead). ?=
lookahead, when, 发现正则表达式引擎应该检查看看后面是什么(提前)。\d
zero or more digits \d
零个或多个数字</UPAvg
match </UPAvg
literally </UPAvg
匹配</UPAvg
字面意思In plain english.用简单的英语。 When comma is found, check characters after and if there is digits after and the end tag </UPAvg
.找到逗号后,检查后面的字符,以及后面是否有数字以及结束标记</UPAvg
。 There is a match, replace with.有一个匹配,替换为。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.