Matching Whitespace & Non-Whitespace Character

Sort by

recency

|

125 Discussions

|

  • + 0 comments
    Regex_Pattern = r"\S{2}\s\S{2}\s\S{2}"
    
    import re
    
    print(str(bool(re.search(Regex_Pattern, input()))).lower())
    
  • + 0 comments

    I hate to be so pedantic, but these task descriptions are pretty bad. For instance, would imply that every is the same non-whitespace character and every is the same whitespace character.

    The problem description should be written differently or come with some minimally-reproducible examples so we can infer what the challenge is really asking for.

  • + 0 comments

    r"(\S{2}\s){2}\S{2}"

  • + 0 comments

    got a working regex but I think I comlicated it ^(([\S][\s])([\S]{2}[\s])([\S]*))$

  • + 0 comments

    In my opinion, either the problem statement is ambigous or it is inconsistent with the test cases.

    Being an excercise to introduce the metacharacters \S and \s, the resolution should be simple and straightfoward, that is /^\S\S\s\S\S\s\S\S$/

    However that expression does not pass some of the test cases. Namely those with multiple whitespaces or non-whitespaces. Thus the solution should be /^\S\S+\s+\S\S+\s+\S\S+$/ which also do not work. So said!!