Regular Expression Replacing Failed [message #478962] |
Fri, 07 August 2009 12:45  |
Eclipse User |
|
|
|
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 #479092 is a reply to message #479066] |
Sun, 09 August 2009 00:00  |
Eclipse User |
|
|
|
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 :)
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.23774 seconds