Utopian Identification Number

Sort by

recency

|

80 Discussions

|

  • + 0 comments

    perl

    while(<>){
        next if $. == 1;
        chomp;
        /^[a-z]{0,3}\d{2,8}[A-Z]{3,}$/ ? print "VALID\n" : print "INVALID\n";
    }
    
  • + 0 comments

    Java 15

    import java.io.*;
    import java.util.*;
    import java.util.regex.Pattern;
    import java.util.regex.Matcher;
    public class Solution {
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            int n = Integer.parseInt(scanner.nextLine());
            Pattern pattern = Pattern.compile("^[a-z]{0,3}[0-9]{2,8}[A-Z]{3,}");
            for(int i=0;i<n;i++)
            {   Matcher matcher = pattern.matcher(scanner.nextLine());
                if (matcher.find()) System.out.println("VALID");
                else   System.out.println("INVALID");
            }
        }
    }
    
  • + 0 comments

    Javascript:

    const lines = input.split("\n");
    lines.shift();
    
    lines.forEach((line) => {
       const status = line.match(/^[a-z]{0,3}\d{2,8}[A-Z]{3,}$/) ? 'VALID' : 'INVALID';
       console.log(status);
    });
    
  • + 0 comments
    import re
    
    regex = re.compile(r'^[a-z]{0,3}[0-9]{2,8}[A-Z]{3,}$')
    
    
    for i in range(int(input())):
        if regex.match(input()):
            print('VALID')
        else:
            print('INVALID')
    
  • + 0 comments
    import re
    
    pattern = r'^[a-z]{,3}\d{2,8}[A-Z]{3}'
    
    for _ in range(int(input())):
        print('VALID' if re.match(pattern, input()) else 'INVALID')