Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(param){
- let first = param.shift();
- for(let item of param){
- let regexItem = /(\@\#{1,})([A-Z][A-Za-z0-9]{4,}[A-Z])(\1)/g;
- let matchItem = item.match(regexItem);
- if(matchItem){
- for(let i of matchItem){
- let findNums = /[\d+]/g;
- let matchNums = i.match(findNums);
- if(matchNums){
- console.log(`Product group: ${matchNums.join('')}`)
- }else{
- console.log(`Product group: 00`)
- }
- }
- }else{
- console.log(`Invalid barcode`)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment