php - Remove string contained within a specific starting and ending string -
i want remove whole substring string when substiring starts "stringa" , ends "/r".
fx original string:
"peterstringanone/rgriffin"
should be
"petergriffin"
demo
$re = '/stringa[\w\d]+\/r/'; $str = 'peterstringanone/rgriffin'; $result = preg_replace($re, '', $str);
php regex
No comments:
Post a Comment