On 26 Apr 2007, at 20:04, John ORourke wrote:
Come on people, someone's gotta do this for a laugh...
&{"do_".lc(($r->uri()=~/(\w+)\.com\//i))}();
sub AUTOLOAD { return undef; }
sub do_google { }
sub do_yahoo { }
Nice :)
--
Andy Armstrong, hexten.net
Come on people, someone's gotta do this for a laugh...
&{"do_".lc(($r->uri()=~/(\w+)\.com\//i))}();
sub AUTOLOAD { return undef; }
sub do_google { }
sub do_yahoo { }
Yeah so I'm bored and ready for home...
John
te anything without triple checking it.
--
Dodger
-Original Message-
From: Martin Moss [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 26, 2007 2:30 AM
To: modperl
Subject: regex quickie
I'm looking for a regex which will help me do this..
$string = 'google.com/?q=test';
On Apr 26, 2007, at 1:47 PM, Andy Armstrong wrote:
Yeah, but that only works if all the sites use q= to prefix the
query - and have to maintain the site names in two places - once in
the RE and once in the despatch table.
It'd be better to parse the query parameters into a hash and pass
On 26 Apr 2007, at 18:32, Jonathan Vanasco wrote:
i'd keep the dispatch essentially the same, but change the regex
to something more like this:
my %despatch = (
'yahoo' => sub { print "\n Yahoo! $_[0]\n"; },
'google' => sub { print "\n Google! $_[0]\n"; },
On Apr 26, 2007, at 9:15 AM, Andy Armstrong wrote:
my %despatch = (
'yahoo' => sub { print "Yahoo!\n"; },
'google' => sub { print "Google!\n"; },
);
my $match = join('|', map {quotemeta} keys %despatch);
my $re = qr/($match)/i; # or whatever
print "Us
On 26 Apr 2007, at 14:15, Andy Armstrong wrote:
my %despatch = (
'yahoo' => sub { print "Yahoo!\n"; },
'google' => sub { print "Google!\n"; },
);
my $match = join('|', map {quotemeta} keys %despatch);
my $re = qr/($match)/i; # or whatever
print "Using
On 26 Apr 2007, at 14:03, Clinton Gormley wrote:
> > perldoc perlre [look for Backtracking]
>
> this doesn't require backtracking to work
>
> just do my ($match) = ($string =~ /(google|yahoo)/i)
my %despatch = (
'yahoo' => sub { print "Yahoo!\n"; },
'google' => sub { print "G
> -Original Message-
> From: Martin Moss [mailto:[EMAIL PROTECTED]
> What I would like to do is test if $string contains one of the patterns
> in the pattern match and then carry out a function based upon which
> pattern is matched...
> Any ideas?
>
>
> perldoc perlre [look for Backtrac
hi
-Original Message-
From: Martin Moss [mailto:[EMAIL PROTECTED]
What I would like to do is test if $string contains one of the patterns
in the pattern match and then carry out a function based upon which
pattern is matched...
Any ideas?
perldoc perlre [look for Backtracking]
h seems this worked today.. Server restart musta
failed when it didn't seem to work..
if ($string =~ /($pattern_match)/i)
--- Martin Moss <[EMAIL PROTECTED]> wrote:
>
> I'm looking for a regex which will help me do this..
>
> $string = 'google.com/?q=test';
>
> $pattern_match = 'google|y
I'm looking for a regex which will help me do this..
$string = 'google.com/?q=test';
$pattern_match = 'google|yahoo|msn';
What I would like to do is test if $string contains
one of the patterns in the pattern match and then
carry out a function based upon which pattern is
matched...
e.g.
if (
12 matches
Mail list logo