使用正则表达式查找FIND然后使用REPLACE字符。 [英] Use regex expression to FIND then REPLACE character.
本文介绍了使用正则表达式查找FIND然后使用REPLACE字符。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的搜索文字:
<time>2017-11-24T18:47:26Z</time>
这是我的正则表达式寻找:
Here's my regex expression for a FIND:
[0-9]T[0-9]
这是我的REPLACE表达式:
Here's my REPLACE expression:
[0-9]</date><time>[0-9]
最后结果如下:
And finally here's the result:
<time>2017-11-2[0-9]</date><time>[0-9]8:47:26Z</time>
我做错了什么在这里?
我尝试了什么:
那个。在那里。我真正想要的是:
What am I doing wrong here?
What I have tried:
That. That up there. What I really want is this:
<time>2017-11-24</date><time>18:47:26Z</time>
解决方案:
查找=> (\d +)T(\d +)
REPLACE => $ 1< / date>< time> $ 2
[END EDIT]
solution:
FIND => "(\d+)T(\d+)"
REPLACE => "$1</date><time>$2"
[END EDIT]
推荐答案
1< / date>< time> ;
1</date><time>
2
[END EDIT]
2"
[END EDIT]
请尝试这种方式。
这是我发现的正则表达式:
(?< = \d) T(?= \d)
这是我的REPLACE表达式:
< / date> < time>
(只是一个快速猜测。)
你仍然会有格式错误的XML。
Try it this way instead.
Here's my regex expression for a FIND:
(?<=\d)T(?=\d)
Here's my REPLACE expression:
</date><time>
(Just a quick guess.)
And you'll still have mal-formed XML.
这篇关于使用正则表达式查找FIND然后使用REPLACE字符。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文