-1

I'm trying to do some validation exercises and I was wondering this code seems to return false always.

if (preg_match("/^[0-9]{7}$/", '1234567')) {
    die('match');
}

I'm currently testing for full-width japanese characters/numbers. I'm wondering why it doesn't execute the die command. Any help is appreciated. Thank you in advance :)

JP Arcilla
  • 29
  • 6

1 Answers1

-1

Regex Match for 1234567 :

Example Code :

<?php
preg_match('/[1234567]+$/','1234567',$output);
preg_match('/[1-7]+$/','5123467',$output);
print_r($output);
?>

OR :

<?php
preg_match('/[1234567]{21}$/','1234567',$output);
preg_match('/[1-7]{21}$/','5123467',$output);
print_r($output);
?>

Related Links :

Max Base
  • 639
  • 1
  • 7
  • 15