PREG_OFFSET_CAPTURE and preg_match()
<?php $s = 'It is a beautiful day'; preg_match ('/beautiful/', $s, $matches, PREG_OFFSET_CAPTURE); var_dump ($matches); ?>