regex - PHP - preg_match() word after other word -


i have text one: the cat born on 1980 , lives ...

so want cat's age regex (the text have more 1 occurrence of number 4 digits).

i'm trying preg_match('/born on [0-9]{4}/', $text, $matches) result is: array('born on 1980'). want ignore before year.

demo: http://www.phpliveregex.com/p/ayl

group value want first item of array.

$text = 'the cat born on 1980 , lives ...'; preg_match('/born on ([0-9]{4})/', $text, $matches); echo $matches[1]; 

output:

1980