fork download
  1. <?php
  2. $mystring = "some text for test and need to replace by regex using php.
  3. We have another sentence";
  4. $regex = '~(?s)^.*?regex\K.*~';
  5. if (preg_match($regex, $mystring, $m)) {
  6. $yourmatch = $m[0];
  7. echo $yourmatch;
  8. }
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
 using php.
We have another sentence