Robert Cummings wrote:
Nathan Rixham wrote:
Yes it was client stripping out extra whitespace! thanks Rob, replicated your results:
2 3
  5 6

and then 'fixed' to give what's needed:
   preg_replace( "/(((\r|)\n)(\h*|))+/im", '\\1' ,  $input );

the above keeps line termination the same as in the source file; can you give it a quick check your side to ensure it works (if you don't mind)?

No, no, you missed my meaning... I don't care about line ending... I care about trailing whitespace on non-empty lines.

modified one that 'cleans' the new lines:
  preg_replace( "/((\r|)\n(\h*|))+/im", PHP_EOL ,  $input );

Yes, this is preferred with respect to line ending IMHO. But it still strips trailing whitesapce.

Almost there... but you've also got that first blank line still hanging around which is supposed to be removed :D

lol ahh hell yeah; trim() it ;) I'm done for the night



PHP General Mailing List (
To unsubscribe, visit:

Reply via email to