Meaning of Regular Expression with JS and PHP
Can anybody explain me the use of this Regular Expression?
I want to truncate characters which has Ascii code less than 32 except
Horizontal Tab, Line Feed and Carriage Return.
Does below code will work accordingly? or Do I need to change it?
JavaScript Code:
var text = text.replace(/[\x00-\x09\x0A\x0D-\x2F]+/, "");
PHP Code
$val = preg_replace('/[\x00-\x09\x0A\x0D-\x2F]/', '',$val);
Edit
I want to preserve LF, HT and CR and not want to truncate them from String
if any. Other characters below Ascii 32 should be Truncated.
No comments:
Post a Comment