Skip to main content



      Home
Home » Newcomers » Newcomers » Regexp MULTILINE mode to find & delete a multi line XML stanza
Regexp MULTILINE mode to find & delete a multi line XML stanza [message #1735506] Mon, 20 June 2016 09:44 Go to next message
Eclipse UserFriend
I have a lot of XML configuration files where I need to remove the following....
<filteredResources>
<filter>
<id>1396938000000</id>
<name></name>
<type>10</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-projectRelativePath-matches-true-false-target</arguments>
</matcher>
</filter>
</filteredResources>

As per the help text of the find dialog
http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
is the implementation engine of Eclipse find.

With Regular expression checked, all of the following find "Containing text:" string have not worked.
<filteredResources>.+<\/filteredResources>(?m).
(?m).<filteredResources>.+<\/filteredResources>

My guess is that since the XML stanza covers more than one line I need to turn on MULTILINE mode.

http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#MULTILINE

I found this little explanation, and came up with the following "Containing text", but it does not work either.

(?m)<filteredResources>.++$(\r\n?|\n)^.*+$(\r\n?|\n)^<\/filteredResources>

But it does not seem to be working. What is the proper way to use the
(?m).
token in the find string?

[Updated on: Mon, 20 June 2016 10:01] by Moderator

Re: Regexp MULTILINE mode to find &amp; delete a multi line XML stanza [message #1735594 is a reply to message #1735506] Tue, 21 June 2016 07:20 Go to previous messageGo to next message
Eclipse UserFriend
That ought to work, but doesn't it seem to work. I'm not sure why. This
however seems to work and handles both Windows and Linux line feeds.

<filteredResources>(.|[\n\r])+</filteredResources>


On 20.06.2016 09:44, Paul Roubekas wrote:
> I have a lot of XML configuration files where I need to remove the
> following....
> <filteredResources>
> <filter>
> <id>1396938000000</id>
> <name></name>
> <type>10</type>
> <matcher>
> <id>org.eclipse.ui.ide.multiFilter</id>
> <arguments>1.0-projectRelativePath-matches-true-false-target</arguments>
> </matcher>
> </filter>
> </filteredResources>
>
> As per the help text of the find dialog
> http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
> is the implementation engine of Eclipse find.
>
> With Regular expression checked, all of the following find "Containing
> text:" string have not worked.
> <filteredResources>.+<\/filteredResources>(?m).
> (?m).<filteredResources>.+<\/filteredResources>
>
> My guess is that since the XML stanza covers more than one line I need
> to turn on MULTILINE mode.
> http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#MULTILINE
>
>
> But it does not seem to be working. What is the proper way to use the
> (?m).
> token in the find string?
Re: Regexp MULTILINE mode to find &amp; delete a multi line XML stanza [message #1735601 is a reply to message #1735594] Tue, 21 June 2016 07:42 Go to previous messageGo to next message
Eclipse UserFriend
Windows 7
Mars2

Confirmed works for me too.

Thanks Ed.
Re: Regexp MULTILINE mode to find &amp; delete a multi line XML stanza [message #1735649 is a reply to message #1735594] Tue, 21 June 2016 11:18 Go to previous message
Eclipse UserFriend
I submitted a report.

Bug 496484 - Multiline search (?m) does not work.

[Updated on: Tue, 21 June 2016 11:18] by Moderator

Previous Topic:Viewing all attributes in the outline window
Next Topic:Java class files for tomcat, where?
Goto Forum:
  


Current Time: Thu Jul 17 06:57:10 EDT 2025

Powered by FUDForum. Page generated in 0.12115 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top