Daniel Gardner wrote:
>
> >>
> >> Why slow it down with the 'i'?
> >> $searchstring=~/[a-zA-Z0-9]/;
>
> > Why slow it down with a regular expression? :-)
>
> > if ( $searchstring =~ tr/a-zA-Z0-9// ) {
>
> i was bored, and thought i'd try a little benchmark. note, this
> is for the specific
On Sat, Dec 08, 2001 at 08:21:38AM +0800, Leon wrote:
> The original poster says at least 1 letter or number .. " i want
> something like..if $searchstring has at least 1 letter or number {
> commands... }";
>
> Therefore it should be $searchstring=~/[a-zA-Z0-9]+/;
The + doesn't do anything
>>
>> Why slow it down with the 'i'?
>> $searchstring=~/[a-zA-Z0-9]/;
> Why slow it down with a regular expression? :-)
> if ( $searchstring =~ tr/a-zA-Z0-9/ ) {
i was bored, and thought i'd try a little benchmark. note, this
is for the specific problem expressed here, not the general case.
- Original Message -
From: "Shawn" <[EMAIL PROTECTED]>
> > $searchstring =~ /[a-z0-9]/i;
>
> Why slow it down with the 'i'?
> $searchstring=~/[a-zA-Z0-9]/;
The original poster says at least 1 letter or number .. " i want
something like..if $searchstring has at least 1 letter or
- Original Message -
From: "John W. Krahn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 07, 2001 5:55 PM
Subject: Re: $searchstring help
> Shawn wrote:
> >
> > > On Fri, Dec 07, 2001 at 04:35:11PM -0500, Maurice Reeves wrot
Shawn wrote:
>
> > On Fri, Dec 07, 2001 at 04:35:11PM -0500, Maurice Reeves wrote:
> > > not quite. \w matches _ also, and he didn't have
> > > that in his list.
> > >
> > > how about
> > > $searchstring =~ /^[a-z0-9]+/i;
> >
> > I'm not sure why you're both anchoring the pattern. He didn't spe
On Fri, Dec 07, 2001 at 05:31:30PM -0600, Shawn wrote:
> Why slow it down with the 'i'?
> $searchstring=~/[a-zA-Z0-9]/;
There is no reason, that's a good point. I was cargo-culting; appending the
/i with no thought because the others were.
Michael
--
Administrator www.s
> On Fri, Dec 07, 2001 at 04:35:11PM -0500, Maurice Reeves wrote:
> > not quite. \w matches _ also, and he didn't have
> > that in his list.
> >
> > how about
> > $searchstring =~ /^[a-z0-9]+/i;
>
> I'm not sure why you're both anchoring the pattern. He didn't specify it
> had to start with a le
On Fri, Dec 07, 2001 at 04:35:11PM -0500, Maurice Reeves wrote:
> not quite. \w matches _ also, and he didn't have
> that in his list.
>
> how about
> $searchstring =~ /^[a-z0-9]+/i;
I'm not sure why you're both anchoring the pattern. He didn't specify it
had to start with a letter or number,
not quite. \w matches _ also, and he didn't have
that in his list.
how about
$searchstring =~ /^[a-z0-9]+/i;
>From: "Etienne Marcotte" <[EMAIL PROTECTED]>
>To: Jesus Is Not Dead <[EMAIL PROTECTED]>
>CC: [EMAIL PROTECTED]
>Subject: Re: $searchstring help
my try:
if ($searchstring =~ /^\w+/) {...}
I can't beleive you typed all the letters:P
Etienne
Jesus Is Not Dead wrote:
>
> hi
> can anyone tell me how to short this...
> if($searchstring =~ /A/i or $searchstring =~ /B/i or $searchstring =~ /C/i
> or $searchstring =~ /D/i or $searchstring =~
hi
can anyone tell me how to short this...
if($searchstring =~ /A/i or $searchstring =~ /B/i or $searchstring =~ /C/i
or $searchstring =~ /D/i or $searchstring =~ /E/i or $searchstring =~ /F/i
or $searchstring =~ /G/i or $searchstring =~ /H/i or $searchstring =~ /I/i
or $searchstring =~ /J/i or $s
12 matches
Mail list logo