Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试编写一个正则表达式,它将在我的 xml 中添加一个节点。
我当前的xml是:
<A> <B>some value</b> </A>
我预期的 xml 是:
<A> <B>some value</b> <C>some new value</C> </A>
所以我想添加C元素。
谁能帮我写正则表达式,我在写正则表达式方面很新。
谢谢
If you're after something quick and hacky, something like this should work:
s/\(<B>.*<\/b>\)/\1<C>Some new value<\/c>/