Matching Anything But a Newline

Sort by

recency

|

407 Discussions

|

  • + 0 comments

    I noticed a big flaw in the test case.

    right now the pattern ^(.{3}\.?){4}$ passes all the test case, but this violates the problem statement that the pattern needs to strictly follow a period after the first three charcters. for example "abcdefghijkl" passes the test, when it shouldn't.

    short solution not violating this constraint can be something like ^...(\....){3}$ which enforces the \.

  • + 0 comments

    Requirements are ambiguous and the comma at the end of the instruction string is hard to see in the given font. I thought the text had to end with a period because the comma's tail is indiscernible (to me).

    I suggest restating the question such that it is more accessible to those with vision problems.

  • + 0 comments

    var pattern = Pattern.compile("...\....\....\....");

  • + 0 comments
    ^(.{3}\.?){4}$
    
  • + 1 comment
    regex_pattern = r"^...\....\....\....$"
    
    import re
    import sys
    
    test_string = input()
    
    match = re.match(regex_pattern, test_string) is not None
    
    print(str(match).lower())