Looking at a similar question
here[
^], I think what you want is (most closely resembling what you've written) is:
preg_replace('/[^\x{20}-\x{7F}]/u','', $row['xmlFeed'])
However, if you truly want to keep all non-Unicode characters, the characters with values 0x00-0x19 are technically valid as well, so you might want
/[^\x{00}-\x{7F}]/u
.
Also some tips on regex in general: don't use parenthesis inside of [] unless you mean to include/exclude parenthesis characters, their meaning changes inside character classes. (For example,
/[(a-z)]+/
would match all lowercase English letters
and ( and ), so it would match the entire string "a(b)c".) In this case, you don't need the * because you want to replace any single character occurrences, from what I could find, PHP does global matching by default, so it will already match all of them. If it didn't, you'd just get the first run of them anyways. Either way, it doesn't help, especially when you consider there are no other constraints to the pattern, this can result in much slower results on some implementations of regex (it will replace every empty string it encounters with the replacement text as well, so for
/a*/
replaced with "c" in the string "aaaaabba" can result in "cbcbc", because the empty string between the two b's can be considered a valid match).