RE: [Phplib-users] Invalid Regex
Brought to you by:
nhruby,
richardarcher
From: Rob H. <rob...@ws...> - 2002-10-31 19:43:37
|
This is the regex being generated: var reg = new RegExp("^[A-Za-z0-9]+$", "gi"); and it fails everything... > -----Original Message----- > From: Matt Williams [mailto:li...@ye...] > Sent: Thursday, October 31, 2002 2:39 PM > To: rob...@ws...; Phplib-Users > Subject: Re: [Phplib-users] Invalid Regex > > > On Thursday 31 October 2002 19:00, Rob Hutton wrote: > > > This will match 123$abc. It should fail if there are any other > characters > > besides alphanumeric. > > I just tried > ----------------- > $string = '123$abc'; > if(!eregi("^[a-z0-9]+$",$string)) > echo 'no good'; > else > echo 'you rock'; > ----------------- > and it outputs > ----------------- > X-Powered-By: PHP/4.2.1 > Content-type: text/html > > no good > ---------------- > removing the $ outputs as valid > unless oohforms is doing something different to it > sorry I missed the + off before > > |