I think that the following should do the trick:

            <replaceregexp flags="g" byline="false">
                <regexp pattern="\r\n[\s]*\r\n[\s]*\r\n"/>
                  <substitution expression="&#13;&#10;&#13;&#10;"/>
                  <fileset dir="${dist}">
                        <filename name="**/*.php"/>
                  </fileset>
            </replaceregexp>

Where "\r\n[\s]*\r\n[\s]*\r\n" means 2 blank lines and
"&#13;&#10;&#13;&#10;" means 1 blank line, so the maximum of blank lines
will be 1.



-----Original Message-----
From: Jürgen Hauser [mailto:[EMAIL PROTECTED] 
Sent: miércoles, 18 de febrero de 2004 20:35
To: [EMAIL PROTECTED]
Subject: Remove blank lines

Hi,

I'm having troubles finding out how to actually remove blank lines.

I have a regular expression which will match all blank lines, but since
it 
needs to be replaced with something, you get the problem ;)

            <replaceregexp flags="g" byline="true">
                <regexp pattern="^[\s]*$"/>
                  <substitution expression=""/>
                  <fileset dir="${dist}">
                        <filename name="**/*.php"/>
                  </fileset>
            </replaceregexp>    

To be honest, what i would really like to achieve is to have it remove 
blank lines only if there are two or more blanklines in a row, so it
still 
leaves one blank line.

ie.

1. $foo = 'bar';
2. blank line
3. blank line
4. $user =& new User();
5. blank line
6. $user->doSomething();

would result in

1. $foo = 'bar';
2. blank line
3. $user =& new User();
4. blank line
5. $user->doSomething();

Thanks a lot in advance!

Regards,
Jürgen



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to