Re: Re: Regular Expression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,
  Thanks for the reply.
I want to know how to include char "-" i.e a dash . I want to test for it.
eg: COSC-3006.
I should be able to test that string as valid.
Also is there a way in which the form validation fails but when the user goes back to the same form its previous values are retained.
 
eg: Suppose the user enters its name, age and phone number.
     But the phone number is wrongly entered. Then he goes back, the old values should still be displayed. Only the phone number should be cleared.
 
Also how to program for such a back button.
In what I have done is simply called the previous form, so it clears all the values.
Any help in appreciated.
 
Thanks in advance.
bye.
Kelly Hallman <khallman@xxxxxxxxxxxxxx> wrote:
Apr 18 at 11:01pm, Andy Ladouceur wrote:
> Andy Amol wrote:
> > I would like to test whether a given sting contains only character, it
> > should also support spaces. eg "Course Book String". I am able to test
> > "CourseBookString". Also I would like to know how can we avoid wild
> > chars like *, or any other char apart from alpha numeric char.
>
> A regexp like this should work:
> /^([a-zA-Z]|\s)+$/

/^[A-Za-z\s]+$/ would be a better way of putting it.
however, \s would match tabs (also CR and/or LF in some regex engines).

to only alpha or space, this would work best:
/^[A-Za-z ]+$/

-- 
Kelly Hallman

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

		
---------------------------------
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux