Re: $searchstring help

2001-12-07 Thread John W. Krahn
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

Re: $searchstring help

2001-12-07 Thread Michael Fowler
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

Re[2]: $searchstring help

2001-12-07 Thread Daniel Gardner
>> >> 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.

Re: $searchstring help

2001-12-07 Thread Leon
- 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

Re: $searchstring help

2001-12-07 Thread Shawn
- 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

Re: $searchstring help

2001-12-07 Thread John W. Krahn
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

Re: $searchstring help

2001-12-07 Thread Michael Fowler
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

Re: $searchstring help

2001-12-07 Thread Shawn
> 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

Re: $searchstring help

2001-12-07 Thread Michael Fowler
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,

Re: $searchstring help

2001-12-07 Thread Maurice Reeves
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

Re: $searchstring help

2001-12-07 Thread Etienne Marcotte
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 =~

$searchstring help

2001-12-07 Thread Jesus Is Not Dead
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