Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 13:44 Go to next message
Paul Roubekas is currently offline Paul RoubekasFriend
Messages: 207
Registered: March 2012
Location: Chattanooga, TN USA
Senior Member
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?


Oxygen 3a
Windows 10

[Updated on: Mon, 20 June 2016 14:01]

Report message to a 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 11:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30353
Registered: July 2009
Senior Member
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 11:42 Go to previous messageGo to next message
Paul Roubekas is currently offline Paul RoubekasFriend
Messages: 207
Registered: March 2012
Location: Chattanooga, TN USA
Senior Member
Windows 7
Mars2

Confirmed works for me too.

Thanks Ed.


Oxygen 3a
Windows 10
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 15:18 Go to previous message
Paul Roubekas is currently offline Paul RoubekasFriend
Messages: 207
Registered: March 2012
Location: Chattanooga, TN USA
Senior Member
I submitted a report.

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


Oxygen 3a
Windows 10

[Updated on: Tue, 21 June 2016 15:18]

Report message to a moderator

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


Current Time: Wed Aug 21 00:42:07 GMT 2019

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

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

Back to the top