This is a discussion on Need help with a regular expression please. within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi. I'm trying to create a regular expression for a form field validation that would permit input something like ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi. I'm trying to create a regular expression for a form field validation
that would permit input something like this: +1 (1-23) 321.1234 ext.12 Any numbers 0-9, plus signs, parentheses (open and close), periods (dots), hyphens, alpha characters e, x, and t, and blank spaces. I have thus far been working with: ^[0-9ext\(\)\+\.\-]*$ Hmm, I should make the alpha characters case insensitive as well. But the problem I'm having is including blank spaces. As you can see from the example input string above, there are blank spaces in the string. Thus far, however, I've not been able to construct my regular expression to permit blank spaces. Any suggestions or help would be appreciated. TIA (Running Mandrake Linux, BASH, PHP.) Marcy |
|
|||
|
In <comp.unix.shell> marcy klein <no_email@noemail.com> wrote:
> Hi. I'm trying to create a regular expression for a form field validation > that would permit input something like this: > > +1 (1-23) 321.1234 ext.12 > > Any numbers 0-9, plus signs, parentheses (open and close), periods (dots), > hyphens, alpha characters e, x, and t, and blank spaces. > > I have thus far been working with: > > ^[0-9ext\(\)\+\.\-]*$ > > Hmm, I should make the alpha characters case insensitive as well. But the > problem I'm having is including blank spaces. ^[ 0-9ext()+.-]*$ > As you can see from the > example input string above, there are blank spaces in the string. Thus far, > however, I've not been able to construct my regular expression to permit > blank spaces. Any suggestions or help would be appreciated. TIA (Running > Mandrake Linux, BASH, PHP.) > > Marcy -- William Park <opengeometry@yahoo.ca>, Toronto, Canada ThinFlash: Linux thin-client on USB key (flash) drive http://home.eol.ca/~parkw/thinflash.html BashDiff: Super Bash shell http://freshmeat.net/projects/bashdiff/ |