
japhy
Enthusiast
Feb 8, 2001, 8:30 AM
Post #2 of 2
(390 views)
|
The simplest thing to do is create a mapping of * and ? to Perl's regex notation:
%map = ( '*' => '.*', '?' => '.', ); # now, convert characters as needed $pattern =~ s/(\W)/$map{$1} || "\\$1"/eg; if ($domain =~ /$pattern/) { match } Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author
|