in reply to Re: Re: Re: Re: Grep Pattern Match
in thread Grep Pattern Match

Ok. In a regex '.' means match any char. (*)

'*' means zero or more of the preceeding char. (**)

So '.*' just means any number of any characters. (*)

If you know for that you only want to match digits, then you would be better using \d* or if you know that there must be at least 2 then \d{2,}.

There's much to much to lay it all out here and it's already written many places perlre would be a good starting point. It will only take you 20 minutes to read it, and you won't take it all in at one go probably, but once you seen it, you'll probably remember were to look next time.

(*)(except \n except in special cases which we can ignore for now, but the internet laywers and perlitists may be watching:)

(**) more correctly, "preceding pattern"


Examine what is said, not who speaks.

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Grep Pattern Match
by LostS (Friar) on Dec 27, 2002 at 16:18 UTC
    I suck at regex... Hell I even admit it... maybe I should find a book like "Regex for Dummies" or "Idiots guide to Regex" That entire structure confuses me sometimes... But thank you for showing me this stuff... It is greatly appricated.

    -----------------------
    Billy S.
    Slinar Hardtail - Hand of Dane
    Datal Ephialtes - Guildless
    RallosZek.Net Admin/WebMaster

    perl -e '$cat = "cat"; if ($cat =~ /\143\x61\x74/) { print "Its a cat! +\n"; } else { print "Thats a dog\n"; } print "\n";'