in reply to Re: remove specific data from a line
in thread remove specific data from a line

This one nearly work but not handle this line
abcefgh qwerty, asdfg yuio jklh
It print out
asdfg yuio jklh
I had to add extra slash to your code like this
$line =~ s/^abc\w+\s+\S+(?:,\s*\S+)*//x;
otherwise got errors. I hope this was what you mean. I try to change your code to handle last line which don't leave just  yuio jklh.
How do I fix this ?
Thank you for answer so far , it show me how much flexible Perl is

Replies are listed 'Best First'.
Re^3: remove specific data from a line
by Roy Johnson (Monsignor) on Feb 03, 2006 at 18:29 UTC
    I forgot to substitute the first word back in.
    $line =~ s/^(abc)\w+\s+\S+(?:,\s*\S+)*/$1/x;
    should give you what you want. You were right about the missing slash.

    Caution: Contents may have been coded under pressure.