Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Regular Expression Replacing Failed
Regular Expression Replacing Failed [message #478962] Fri, 07 August 2009 16:45 Go to next message
YaoXing Zhang is currently offline YaoXing Zhang
Messages: 7
Registered: July 2009
Junior Member
Hello guys,
I'm trying to replace all the empty lines in a CSS file. So I have the
following regular expression:
(?<=\r\n)\s*\r\n
And this is a piece of sample text:
body
{
background: url("/Images/bg_tcm59-1362.gif") repeat-x;
height:auto;

}

input
{
border: 1px;

}
I can find all the empty lines by using this expression, but if I do
replacement, nothing would happen. This seems to be happening only if
there's a positive lookahead zero-width assertion in the expression. Has
anyone met the same problem?

Eclipse: 3.5 Build id: 20090619-0625
WTP:3.1-20090616035105

Regards,
Yaoxing
Re: Regular Expression Replacing Failed [message #479066 is a reply to message #478962] Sat, 08 August 2009 18:46 Go to previous messageGo to next message
David Williams is currently offline David Williams
Messages: 176
Registered: July 2009
Senior Member
Yaoxing Zhang wrote:
> I can find all the empty lines by using this expression, but if I do
> replacement, nothing would happen. This seems to be happening only if
> there's a positive lookahead zero-width assertion in the expression.
> Has anyone met the same problem?
>
Cool bug. Caught my attention, I reproduced, then searched bugzilla
(Eclipse, Platform, Text) and found a bug already open:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=209174

Looks like it was found a while back (and still not fixed) so you might
comment/vote/follow that bug to let them know it effects you.
Or ... provide a patch? :)

Also ... since I'd never heard of positive lookahead zero-width
assertions, I read up on them ... I learn so much looking at bugs ...
and I think the example you posted here is a positive lookbehind example
(but, I don't mean to detract from the coolness :)
Re: Regular Expression Replacing Failed [message #479092 is a reply to message #479066] Sun, 09 August 2009 04:00 Go to previous message
YaoXing Zhang is currently offline YaoXing Zhang
Messages: 7
Registered: July 2009
Junior Member
Sorry for the carelessness. I'm just a little bit confused by these long
confusing professional words, since I'm also new to regular expression.
But that makes it even cooler, doesn't it? :)
Anyway, thanks for help!

On 2009/8/8 13:46, David Williams wrote:
> Yaoxing Zhang wrote:
>> I can find all the empty lines by using this expression, but if I do
>> replacement, nothing would happen. This seems to be happening only if
>> there's a positive lookahead zero-width assertion in the expression.
>> Has anyone met the same problem?
>>
> Cool bug. Caught my attention, I reproduced, then searched bugzilla
> (Eclipse, Platform, Text) and found a bug already open:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=209174
>
> Looks like it was found a while back (and still not fixed) so you might
> comment/vote/follow that bug to let them know it effects you.
> Or ... provide a patch? :)
>
> Also ... since I'd never heard of positive lookahead zero-width
> assertions, I read up on them ... I learn so much looking at bugs ...
> and I think the example you posted here is a positive lookbehind example
> (but, I don't mean to detract from the coolness :)
>
>
>
Previous Topic:Why is the "WTP Webservice UI PLug-in" loaded during startup?
Next Topic:JavaScript Library
Goto Forum:
  


Current Time: Sun Oct 26 00:34:50 GMT 2014

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

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