in reply to Re: Extracting sometimes null string from text variable
in thread (Solved) Extracting sometimes null string from text variable

The \s can eat newlines, so the .* gets stuff from the next line. Try \h (horizontal space) instead.
  • Comment on Re^2: Extracting sometimes null string from text variable

Replies are listed 'Best First'.
Re^3: Extracting sometimes null string from text variable
by LanX (Saint) on Sep 17, 2017 at 19:07 UTC
    > Try \h (horizontal space) instead.

    Indeed a solution with \h is much easier!

    use strict; use warnings; my $case1 = "Club: Some Club Comments: "; my $case2 = "Club: Comments: "; for ($case1,$case2){ /(Club:)\h*(.*?)\h*\n/; print "<$2>\n"; }

    <Some Club> <>

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!