Matching {x} Repetitions

Sort by

recency

|

102 Discussions

|

  • + 0 comments
    Regex_Pattern = r'^[a-zA-Z24680]{40}[13579\s]{5}$'
    
    import re
    
    print(str(bool(re.search(Regex_Pattern, input()))).lower())
    
  • + 0 comments

    It clearly tests understanding of how to match a specific number of occurrences of a character or pattern. Mahadev Book 777

  • + 0 comments

    Regex_Pattern = r'^[a-zA-Z02468]{40}[13579\s]{5}$' # Do not delete 'r'.

  • + 0 comments

    What made this confusing, was that in a previous problem it stated that 0/zero did not count as even. But on this problem 0/zero is counted as even

  • + 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);
            Pattern pattern = Pattern.compile("^[a-zA-Z02468]{40}[13579\\s]{5}$");
            Matcher matcher = pattern.matcher(scanner.nextLine());
            boolean found = matcher.find();
            System.out.println(found);
        }
    }