Ask a Question related to PHP Development, Design and Development.
-
jeff@nospam.com #1
Pattern matching for xx-xx-xx string
Hello,
What is the syntax to make sure the user has entered this pattern in a
web form:
xx-xx-xx
where x are integers, for example: 12-53-89
Can anybody help?
Thanks.
jeff@nospam.com Guest
-
pattern matching
brian liu <xliu75@yahoo.com> wrote: or $defaultDir='d:/haha'; or -
Pattern Matching Operators
Is there a similar operator in Perl for ${variable##pattern} as there is in korn shell. Thanks for the help. Prasad ... -
Pattern matching username
Is this doing what it is suppose to and how efficient? rule - valid chars A-z0-9 _ - . - cannot start with a digit - cannot start with a space... -
[PHP] mysql Pattern Matching
From: "Ralph Guzman" <ralph213@sbcglobal.net> Actually no, I guess there isn't. Neither one will use an index. mysql> desc test;... -
mysql Pattern Matching
i'm doin this offlist -----Original Message----- From: Ralph Guzman Sent: Thursday, September 04, 2003 10:23 PM To: PHP General Mailing List... -
Janwillem Borleffs #2
Re: Pattern matching for xx-xx-xx string
[email]jeff@nospam.com[/email] wrote:
With preg_* functions, use:> Hello,
>
> What is the syntax to make sure the user has entered this pattern in a
> web form:
>
> xx-xx-xx
>
> where x are integers, for example: 12-53-89
>
"/^(\d{2}-){2}\d{2}$/"
With ereg* functions, use:
"^([0-9]{2}-){2}[0-9]{2}$"
JW
Janwillem Borleffs Guest
-
Alvaro G Vicario #3
Re: Pattern matching for xx-xx-xx string
*** [email]jeff@nospam.com[/email] wrote/escribió (Mon, 19 Jan 2004 17:26:14 +0000):
[0-9][0-9]-[0-9][0-9]-[0-9][0-9]> What is the syntax to make sure the user has entered this pattern in a
> web form:
>
> xx-xx-xx
>
> where x are integers, for example: 12-53-89
[0-9]{2}-[0-9]{2}-[0-9]{2}
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Alvaro G Vicario Guest
-
jeff@nospam.com #4
Re: Pattern matching for xx-xx-xx string
On Mon, 19 Jan 2004 18:47:08 +0100, Alvaro G Vicario
<alvaro_QUITAR_REMOVE@telecomputeronline.com> wrote:
Thanks, it works if format is correct:>[0-9][0-9]-[0-9][0-9]-[0-9][0-9]
>[0-9]{2}-[0-9]{2}-[0-9]{2}
if ( ereg ("[0-9]{2}-[0-9]{2}-[0-9]{2}", $INPUT_bank_sort_code) )
{
print "Yep, OK";
}
However, I want the function to work if it's wrong. What is the
syntax? I thought it would be:
if ( ereg ("^([0-9]{2}-[0-9]{2}-[0-9]{2})", $INPUT_bank_sort_code) )
{
print "Nope, the format is wrong";
}
but it does not work. What is the correct syntax?
Thanks
jeff@nospam.com Guest
-
Janwillem Borleffs #5
Re: Pattern matching for xx-xx-xx string
[email]jeff@nospam.com[/email] wrote:
It's time for you to look into the manual:> However, I want the function to work if it's wrong. What is the
> syntax? I thought it would be:
if ( !ereg(.....
JW
Janwillem Borleffs Guest
-
Cameron #6
Re: Pattern matching for xx-xx-xx string
Janwillem Borleffs wrote:
*Grin* saying that,> [email]jeff@nospam.com[/email] wrote:>>> However, I want the function to work if it's wrong. What is the
>> syntax? I thought it would be:
> It's time for you to look into the manual:
>
> if ( !ereg(.....
>
>
> JW
if (!strcasecmp(.. wouldn't do what you would think and does confuse newbies
to PHP and C/C++ for that matter ;)
~Cameron
Cameron Guest
-
Janwillem Borleffs #7
Re: Pattern matching for xx-xx-xx string
Cameron wrote:
Nothing that can't be fixed by reading the manual ;-)> if (!strcasecmp(.. wouldn't do what you would think and does confuse
> newbies to PHP and C/C++ for that matter ;)
>
JW
Janwillem Borleffs Guest
-
Cameron #8
Re: Pattern matching for xx-xx-xx string
Janwillem Borleffs wrote:
manual?! PSH! I'm a MAN! I fiddle till I get it right!> Cameron wrote:>>> if (!strcasecmp(.. wouldn't do what you would think and does confuse
>> newbies to PHP and C/C++ for that matter ;)
>>
> Nothing that can't be fixed by reading the manual ;-)
>
>
> JW
lol nah, I jest, the PHP website manual is REALLY useful, and well designed
may I add.
~Cameron
Cameron Guest



Reply With Quote

