-2

I need to validate and email address when someone signs up.it should be something like 1234567@burnswin.edu.au

7 numbers @ and last part should be exactly like burnswin.edu.au Please help me with a regular expression.

koshi18
  • 53
  • 9
  • 2
    @ShivanRaptor Not really a duplicate. This question has a stricter definition of a *valid email*. The OP could have at least made an attempt though. – alex May 20 '13 at 06:31

2 Answers2

1

use this one

/^[0-9]{7}@burnswin\.edu\.au\z/
AMember
  • 3,037
  • 2
  • 33
  • 64
0

In your case, you could use..

$valid = preg_match("/^\d{7}@burnswin\.edu\.au\z/", $userSuppliedStr);

CodePad.

The \d will match 0-9, and the {7} will match 7 of them only.

The ^ matches the start of the string and the \z matches the end of the string.

alex
  • 479,566
  • 201
  • 878
  • 984