John Rudd wrote: > $allowregex = '(\.gif$)|(\.jpg$)(and more expressions)'; > $denyregex = '(\.exe$)|(\.com$)|(\.ma[dgf]$)(and more expressions)'; > > But I couldn't figure out a way to get perl to tell me _which_ part of > the regular expression was matched (you can get it to tell you which > part of the _target_ string was matched, like command.com matched > against ".com", if you use $&, which is REALLY slow ... but it wont > tell you that in the regex it matched (\.com$), so that you can use it > as an index into a hash that contains logtxt and usertxt ... so I > would still have to iterate through to find out what rule was > tripped, so that I can then return the appropriate logtxt and usertxt > ... so in the end, that wouldn't be any faster than what's above.
Do this - note only one set of parentheses per variable $allowregex = '(\.gif$|\.jpg$|and more expressions)'; $denyregex = '(\.exe$|\.com$|\.ma[dgf]$|and more expressions)'; Then the part that matched is in $1 If the file was something.mag and matched \.ma[dgf]$, $1 eq ".mag" -- Matthew.van.Eerde (at) hbinc.com 805.964.4554 x902 Hispanic Business Inc./HireDiversity.com Software Engineer _______________________________________________ Visit http://www.mimedefang.org and http://www.roaringpenguin.com MIMEDefang mailing list [email protected] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

