in reply to Re: Anything that is not ',' except .... RegEx question
in thread Anything that is not ',' except .... RegEx question

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re^3: Anything that is not ',' except .... RegEx question
by eric256 (Parson) on Feb 27, 2008 at 15:39 UTC

    I was greatly entertained by how you ignored every last shred of advice in this topic. You didn't even take the part about [\d|\.] not meaning what you think it means, and used it anyway.

    Either way i would talk to the person sending you this CSV since its not a legal CSV if they are putting data with commas in it without quoting those fields.

    BTW you can store repeated elements of your regex in a named variable. Like:

    my $num = qr/[\d.]+/; if ($line = m/^([^,]+),([^,]+),$num,$num,$num,$num,,$num,$num,$num,$nu +m,,$num,$num,$num,$num/) {

    That way if you want to update that pattern you can update it just once.


    ___________
    Eric Hodges
Re^3: Anything that is not ',' except .... RegEx question
by tirwhan (Abbot) on Feb 27, 2008 at 15:27 UTC

    And here, ladies and gentlemen we have, once again, our prime exhibit of stupidity and unwillingness to learn. There really is no other like him in the monastery.

    You have doubts? Perhaps you think I am being uncouth and should admonish the poor creature more kindly? I will put your minds at ease with just two simple exhibits:

    Exhibit A (posted by the kindly orbtwo):

    The inside of a [...] is a bunch of chars, not a bunch of strings, and certianly not another regex. [\d|\.] doesn't mean a digit or a dot, it means a digit, a pipe, or a dot. [\d.] would be a digit or a dot.

    To which our valiant Sir Doesntwannaknow replied (Exhibit B):

    ... something like the following: ...
    m/^([^,]+),([^,]+),[\d|\.]+,[\d|\.]+,[\d|\.]+,[\d|\.]+,,[\d|\.],[\d|\. +]+,[\d|\.]+,[\d|\.]+,,[\d|\.]+,[\d|\.]+,[\d|\.]+,[\d|\.]+/

    I rest my case and fall over laughing.


    All Wins posts are stupid.
    A reply falls below the community's threshold of quality. You may see it by logging in.