in reply to Re: regex trouble
in thread regex trouble

The two changed lines then become:

my $pattern= "(,|\\||:|>|\\]\\[|_\\|_)"; my @splitted= split /$pattern/,$text;

I know you're trying to stay as close as possible to the OP's code, but as an additional recommendation, for maximum clarity in such a situation one should really follow a cleaner approach like trwww's++ or if using a single hardcoded regex, then taking advantage of the /x modifier and throw in suitable whitespace.

Replies are listed 'Best First'.
Re^3: regex trouble
by GrandFather (Saint) on May 30, 2007 at 20:43 UTC

    At some point adding whitespace

    leads

    to

    reduced

    clarity

    and

    slower

    comprehension

    .

    Two things would clean those particular lines up in my view - adding /x as you suggest, and using a character set for the single character delimiters:

    my $pattern= "([,|:>] | \\]\\[ | _\\|_)"; my @splitted= split /$pattern/x, $text;

    DWIM is Perl's answer to Gödel