in reply to friday morning regex
Well $1 obviously only matches foo.com. what you want is to print $_ if you have all 4. Alternatively if you actually want the three separate (and know that there are only three) then you can with doHints , or possibly elbow in ribs needed on parsing a Subject: header + to grab the complete string Three (I hope) Subject variations : "foo.com, bar.net, blah.org, trivial.com"; "foo.com, bar.net, blah.org & trivial.com"; "foo.com, bar.net, blah.org and trivial.com"; <SNIP CODE> prints only the first domain, much to my annoyance.
Probably better to use split and get a list as inmy ($first, $second, $third, $fourth) = (/^([\w.-]+((,\s?)|(\s&\s)|(\s +and\s)|$))+/)
Update: fix typos and s/3/4/; I need my coffee too!my @topics = split(/(?:,|\s*&|\s*and)\s*/)
Dingus
Edit by tye to change PRE to CODE around wide lines
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: friday morning regex
by Anonymous Monk on Nov 08, 2002 at 11:42 UTC |