HuyPV
Saturday, October 10, 2009
input = input.replace(/\\\//g, '/');
var output = input.replace(/\\u([0-9a-f]{4})/gi, function (m, key, value) {
//alert(key + '-' + value);
var hex = m.substring(2);
var code = parseInt(hex, 16);
return String.fromCharCode(code);
});
Title:
Regex and callback function when replace
Description:
input = input.replace(/\\\//g, '/'); var output = input.replace(/\\u([0-9a-f]{4})/gi, function (m, key, value) { //alert(key + ...
...
Rating:
4