Advertisement
nikolayneykov

Untitled

Mar 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(params) {
  2.     let [firstPart, secondPart, thirdPart] = params[0].split('|');
  3.     let asciiSymbols = firstPart.match(/([#$%*&])([A-Z]+)(\1)/)[2]
  4.         .split('')
  5.         .map(c => c.charCodeAt(0));
  6.  
  7.     asciiSymbols.forEach(s => {
  8.         let length = secondPart.match(new RegExp(`${s}:([0-9]{2})`));
  9.         length = Number(length[1]);
  10.         let match = thirdPart.match(new RegExp(`(^|\\s)(${String.fromCharCode(s)}.{${length}})($|\\s)`));  
  11.        
  12.         console.log(match[0])
  13.     });
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement