Replacing HEX with HEX using preg_replace()
Posted: Thu Sep 20, 2007 6:49 pm
Hello,
This might be more of a PHP-thing than REGEX, but here's my problem:
I am using a HEX value to find and replace 'white spaces' with 'x':
take this example: $string = preg_replace('/[\x{20}]/u', 'x', $string);
But I want 'x' to be a HEX number that replaces '20', I have tried the following with no luck:
$string = preg_replace('/[\x{20}]/u', '\x{21}', $string);
I am replacing it with somthing outside of the displayable charecter range, so the replacement has to be in (and stored as) HEX form, can anyone help?
This might be more of a PHP-thing than REGEX, but here's my problem:
I am using a HEX value to find and replace 'white spaces' with 'x':
take this example: $string = preg_replace('/[\x{20}]/u', 'x', $string);
But I want 'x' to be a HEX number that replaces '20', I have tried the following with no luck:
$string = preg_replace('/[\x{20}]/u', '\x{21}', $string);
I am replacing it with somthing outside of the displayable charecter range, so the replacement has to be in (and stored as) HEX form, can anyone help?