From: Jacob Fugal Date: 2005-04-21T01:54:03+09:00 Subject: Re: Another(!!) Newbie question On 4/20/05, Ryan Leavengood wrote: > Here is a very simple (maybe naive) regular expression to use to parse > this data: > > /^:(.*)!(.*) (.*) #(.*) :(.*)$/ As a general rule, remember that .* is "evil"[1]. There are times when it is useful, but usally it is not what you want. The semantics are too liberal introducing possible mismatches and even when correct it is one of the slowest of possible alternatives. Usually the . can be replaced with a negation of the character set of whatever follows. For example, I'd write the above regex as: /^:([^!]*)!(\S*)\s(\S*)\s#(\S*)\s:(.*)$/ Jacob Fugal [1] http://perlmonks.org/index.pl?node_id=24640