language: PHP (php 5.4.4)
date: 1056 days 10 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
 
$test = array(
  "This string is ok",
  "Thi$ string is NOT ok, and should be emptied",
  "No way!!!",
  "YES YES YES"
);
 
foreach ($test as $str) {
  echo preg_replace('/^[a-zA-Z0-9 ]*+.+$/', '<censored!>', $str)."\n";
}
 
?>