Ivankooo1

fancyBorder

Apr 6th, 2020
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(param){
  2.     let first = param.shift();
  3.     for(let item of param){
  4.         let regexItem = /(\@\#{1,})([A-Z][A-Za-z0-9]{4,}[A-Z])(\1)/g;
  5.         let matchItem = item.match(regexItem);
  6.  
  7.         if(matchItem){
  8.            
  9.             for(let i of matchItem){
  10.                 let findNums = /[\d+]/g;
  11.                 let matchNums = i.match(findNums);
  12.  
  13.                 if(matchNums){
  14.                     console.log(`Product group: ${matchNums.join('')}`)
  15.                 }else{
  16.                     console.log(`Product group: 00`)
  17.                 }
  18.             }
  19.  
  20.         }else{
  21.             console.log(`Invalid barcode`)
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment