If you have “strings such as dates” in your input, you can use a regular expression with a positive lookbehind to make sure the digits and slashes contain 7 to 8 digits, and then follow with word boundaries:
'~\b(?=(?:\D*\d){7,8}\b)\d+(?:/\d+)+\b~'
See the demo version of regex .
More details
\b - word boundary(?=(?:\D*\d){7,8}\b) - , , 7 8 ,\d+ - 1(?:/\d+)+ - 1 / + 1\b - .
- PHP:
$str = "Text containing \n082/5/2016\n0825/2016\n08/252/016\n08/25/201\n0/85/2016\n08/25/2016";
$result = preg_replace('~\b(?=(?:\D*\d){7,8})\d+(?:/\d+)+\b~', "", $str);
echo $result;