Matching Start & End

Sort by

recency

|

101 Discussions

|

  • + 0 comments

    Regex_Pattern = /^\d\w{4}.$/

  • + 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("^\\d\\w\\w\\w\\w\\.$");   \\WORKS
            Pattern pattern = Pattern.compile("^\\d\\w{4}\\.$");
            Matcher matcher = pattern.matcher(scanner.nextLine());
            boolean found = matcher.find();
            System.out.println(found);
        }
    }
    
  • + 0 comments

    tester.checker("^\d\w{4}\.$");

  • + 0 comments

    java solution

    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("^\\d[a-z0-9]{4}.$");
            Matcher matcher = pattern.matcher(scanner.next());
            System.out.println(matcher.find());
        }
    }
    
  • + 0 comments
    Regex_Pattern = r"^\d{1}\w{4}\.$"	# Do not delete 'r'.
    
    import re
    

    python3 solution