You could add is_integer() into the if statement.
On 15 Oct 2004, at 14:07, Robert Cummings wrote:
On Fri, 2004-10-15 at 07:45, Gareth Williams wrote:
Do you even need a regex?
What about
if (strlen($_POST['mobile_number']) != 11 &&
substr($_POST['mobile_number'],0,3) != 447)
{
$error="Inva
Try is_int($_POST['mobile_number']) or ctype_digit($_POST['mobile_number'])
HTH
Cheers
Chris
Robert Cummings wrote:
On Fri, 2004-10-15 at 07:45, Gareth Williams wrote:
Do you even need a regex?
What about
if (strlen($_POST['mobile_number']) != 11 &&
substr($_POST['mobile_number'],0,3) != 447)
{
$
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
On 15 October 2004 12:39, Shaun wrote:
> Hi,
>
> Could anyone help me with a reugular expression for a UK mobile phone
> number?
>
> So far I have tried this but with no success
Shaun wrote:
Hi,
Could anyone help me with a reugular expression for a UK mobile phone
number?
So far I have tried this but with no success
$regexp = "/^447[0-9]{9}$/";
if(!preg_match( $regexp, $_POST[mobile_number] )){
$error = "Invalid Mobile Number";
The number nust be 11 numbers long,
On Friday 15 October 2004 19:38, Shaun wrote:
> Could anyone help me with a reugular expression for a UK mobile phone
> number?
>
> So far I have tried this but with no success
>
>
> $regexp = "/^447[0-9]{9}$/";
> if(!preg_match( $regexp, $_POST[mobile_number] )){
> $error = "Invalid Mobile
On Fri, 2004-10-15 at 07:45, Gareth Williams wrote:
> Do you even need a regex?
>
> What about
>
> if (strlen($_POST['mobile_number']) != 11 &&
> substr($_POST['mobile_number'],0,3) != 447)
> {
> $error="Invalid Number";
> }
This doesn't verify that the portion following 447 is also a num
Do you even need a regex?
What about
if (strlen($_POST['mobile_number']) != 11 &&
substr($_POST['mobile_number'],0,3) != 447)
{
$error="Invalid Number";
}
On 15 Oct 2004, at 13:38, Shaun wrote:
Hi,
Could anyone help me with a reugular expression for a UK mobile phone
number?
So far I have tried
On Apr 8, 2004, at 2:40 PM, Shaun wrote:
Thanks for your reply Michal,
but the regular expression still seems to reject the number...
Just out of curiosity,
Have you tried " if(stripslashes(htmlentities($_POST[mobile_number]) )
!= ") ?
--
PHP General Mailing List (http://www.php.net/)
To unsubs
>but the regular expression still seems to reject the number...
Can you provide an example of numbers it rejects?
My answer was based on the simple fact that you were testing for numbers
that matched, and returning a rejection based on that. The regexp is
simple enough -- some examples of input w
Thanks for your reply,
but the number cannot be out side the UK or contain spaces, leading zeros,
brackets or dashes
"Jochem Maas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> you should also be considering spaces, leading zeros, brackets, dashes &
> international notation.
>
>
you should also be considering spaces, leading zeros, brackets, dashes &
international notation.
/^(((\+|00)[- ]?[0-9]{2,3}[- ]?(\(0\))?[-
]?[1-9]{1}[0-9]{1,})|(0[1-9]{1}[0-9]{1,}))[- ]?(([0-9]{7,})|([0-9]{3}[
-]{1}[0-9]{4}))$/
line-wrapping is unintentional, no garantees as to how good it is.
"Michal Migurski" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >I am trying to create a regular expression for a mobile phone number. The
> >number must be 12 digits long(0-9) and begin with 447 and have no spaces.
> >So far I have come up with this but it keeps telling me the num
>I am trying to create a regular expression for a mobile phone number. The
>number must be 12 digits long(0-9) and begin with 447 and have no spaces.
>So far I have come up with this but it keeps telling me the number is
>invalid even when its correct!
Try this:
$regexp = "/447[0-9]{9}/";
13 matches
Mail list logo