Reputation: 16174
I am using Intellij.
I have this xml:
...
<ml:comment />
<ml:pohpoh>
...
and i want to make it look like this:
...
<ml:comment />
<ml:dodo>Volvo</ml:dodo>
<ml:pohpoh>
....
but there is a lot of it, so i wanted to use the replace in path feature.
However, this doesn't work (i am trying a single relpace-in-file before I replace all in the path!)
Find:
ml:comment />[\n].*<ml:[^dodo]
Replace:
ml:comment />\$1.*<ml:dodo>Volvo</ml:dodo>\n\$2
Also ~ I am concerned the right number of spaces won't be put in, how would i capture all those spaces?
Upvotes: 1
Views: 1087
Reputation: 4795
Find:
(<ml:comment\s*/>)(\s*)(?!<ml:dodo)
Replace:
$1$2<ml:dodo>Volvo</ml:dodo>$2
This should maintain indentation which I assume is what you were worried about in terms of losing whitespace.
Upvotes: 7
Reputation:
So you want to find/replace
(<ml:comment\s*/>)\s*<(?!ml:dodo)
,
$1\n<ml:dodo>Volvo</ml:dodo>\n<
?
Upvotes: 3