2022-02-25 12:24:28 +08:00

18 lines
486 B
JavaScript

#!/usr/bin/env node
let str1 = "window.screen.orientation \\x26\\x26 /^landscape/.tes";
str1 = str1
.replace(
/[^\\]((\\x[\da-f]{2}|\\u[\da-f]{4})){1,}/gi,
function ($0, $1, $2) {
console.log($0, eval('"' + $0 + '"'));
return eval('"' + $0 + '"');
}
)
.replace(/\\[\s\S]{1}/gi, function ($0, $1, $2) {
// console.log($0, $1)
const c = $0 === "\\n" ? "\n" : $0[1];
return c;
});
console.log(str1);