Matching Anything But a Newline

Sort by

recency

|

413 Discussions

|

  • + 0 comments

    hints:

    1. ^ --> matches the start of a string
    2. . --> matches any character except a newline
    3. \. --> matches . (dot) in a string
    4. $ --> matches the end of a string
  • + 0 comments

    Why is the testcase failing at hackerrank when it is working fine for me on google colab? regex_pattern = r"(....)+..."

  • + 0 comments

    "Your task is to write a regular expression that matches only and exactly strings of form: abc.def.ghi.jkx."

    1. It doesn't specify there should only be 4 groups of "xxx.", so I thought "abc.def.ghi.jkl.mno" would match
    2. It isn't clear the last dot next to x is included in the string or not.
  • + 0 comments

    "^.{3}..{3}..{3}..{3}$"

  • + 0 comments

    I think we have a wrong test cases here. pattern /(.{3}.){3}.{3}/ with string 1123.456.abc.def must return false. How can it return true In PHP and JavaScript it works wrong, but if I select python it works but failed in another cases.