Symbolic Representation Of Return | \x0a Vs. Other
I'm trying to verify my code. Here is a regex check on it with out 0xa: As you can see at some places where there is a return character the regex does not match b.c. 0xa is used f
Solution 1:
I was surprised that it look like it groups the rows together, but it has to do with the star in your regexp. Change your regexp to [\x20-\x7e]+
. Using the plus sign (one or more matches) instead of star (zero or more matches) I think you get the expected result.
If you want to see whats really is in the inputText-field on regexpal, open up the console in your browser and run document.getElementById('inputText').value.replace(/[^\x20-\x7e]/g,function(a){a = a.charCodeAt(0).toString(16); return '\\u0000'.slice(0,6-a.length) + a;});
and you will get a true representation of the string.
Pretty print:
document.getElementById('inputText').value.replace(
/[^\x20-\x7e]/g,
function (a){
a = a.charCodeAt(0).toString(16);
return'\\u0000'.slice(0,6-a.length) + a;
}
);
Post a Comment for "Symbolic Representation Of Return | \x0a Vs. Other"