I have a text file and I want to remove lines that contain certain characters completely. For example a text file like this where I want lines that contain Chinese characters to be removed:
A.我不要这些汉字
Ok I see
有人会懂我写的吗?
Why not then?
我看够呛。
This is just an example
$myfile = "somtext.txt";
$handle = fopen($myfile, "r");
$book = fread($handle, filesize($myfile));
fclose($handle);
$book = preg_replace("/\p{Han}+/u","", $book);
echo nl2br($book);
But with this code the Chinese gets deleted ok but the punctuation is left and any alphanumeric characters are left on the line. Moreover, the line itself is still there. It ends up like this:
A.
Ok I see
?
Why not then?
。
This is just an example
But I need it to look like this:
Ok I see
Why not then?
This is just an example
EDIT: I want to do this before converting it to an array.