http://www.perlmonks.org?node_id=537813


in reply to regex die?

my ($msg, $line) = (split /\s*at|line\s*|\.$/, $input)[0,2];

With GrandFather's caveat.

Replies are listed 'Best First'.
Re^2: regex die?
by GrandFather (Saint) on Mar 19, 2006 at 23:15 UTC

    except that the regex solution I gave returns all the text, even if it gets the split point wrong. The "split on 'at' solution" throws away anything after a second at, which is a lot worse.


    DWIM is Perl's answer to Gödel

      *shrug*, if I had a version that launched nuclear weapons when the message contained an 'at', it would still be the case than an assumption had been violated and that subsequent assumptions are then in peril.