Problem with Regular Expression

Can anyone help with regular expression for
This what i came out with but is not working as i expected

Please check and modifield my expression


How do you want it to work?

I’m using preg_match($reg, $_POST[‘matric’]);
I expect the user to enter his matric number in the following format

ebsu-Is the starting follow by /forward slash of hypen-. I also expect a year 2009,2010 etc… follow by four digit number \d{4}

What about this?


Of course, it also accepts ebsu-3333/1119 (- and /, and a year far far in the future).

If you want to check the value of the year more specifically, you could do

preg_match('#^ebsu[/-](\\d{4})[/-]\\d{4}$#', 'ebsu-2009/1128', $matches);

It would return

    [0] => ebsu-2009/1128
    [1] => 2009

and then you can do more specific checks on the value in $matches[1].

Thanks very much: It does the work for me…