For more information... RTFM!
NAVIGATION
RECENTLY VIEWED
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0
Powered by Interchange version 5.7.0

line

Discard all but the first line of the body text.  The first line ends with one of the following:

  • A line feed ("\n").
  • A carriage returm, line feed sequence ("\r\n").
  • The end of the text.

Anything after this is discarded.

This filter does not treat an ASCII NUL ("\0") character as a line ending, nor does it recognise a carriage return ("\r") that is not immediately followed with a line feed ("\n").  If you want to strip everything after an ASCII NUL or ASCII CR, then use the "oneline" filter instead.

Example

[filter line]Line 1
Line 2
Line 3
[/filter]

Results in:

Line 1

Source code

sub {
    my $val = shift;

    $val =~ s/^(.*?)\r?\n.*$/$1/s;
    return $val;
}

Category:  Filters
Last modified by: Kevin Walsh
Modification date: Friday 23 February 2007 at 7:57 PM (EST)
SPONSORS
Cursor Software: Expert Interchange consultancy
Webmaint.net: UK Interchange business hosting
Home  |  Legal nonsense  |  Privacy policy  |  Contact us