<?php
$mystring = "some text for test and need to replace by regex using php.
We have another sentence";
$regex = '~(?s)^.*?regex\K.*~';
if (preg_match($regex, $mystring, $m)) {
    $yourmatch = $m[0]; 
    echo $yourmatch;
    } 