Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(arg) {
- var pattern = /<p>((?:(?!(?:<\/p>)).)+)+<\/p>/g;
- var output = '';
- for (var i = 0; i < arg.length; i++) {
- while (match = pattern.exec(arg[i])) {
- var str = match[1].replace(/[^a-z\d]+/g, ' ');
- for (var c = 0; c < str.length; c++) {
- var char = str[c];
- if (isLetter(str[c])) {
- var charCode = str.charCodeAt(c);
- charCode = charCode < 110 ? charCode += 13 : charCode -= 13;
- char = String.fromCharCode(charCode);
- }
- output += char;
- }
- }
- }
- console.log(output);
- function isLetter(str) {
- return str.length === 1 && str.match(/[a-z]/g);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment