I have the following regex expression in PHP
/^(\d{4}-(\d{4})?)$/
I want match only a string like this
1998-
1998-2015
I am using it in laravel validation like so:
'release_year' => 'required|regex:/^(\d{4}-(\d{4})?)$/'
Nothing else should match and number should be a 4 digit number. But it doesn't seem to be working.