We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Matching Anything But a Newline
Matching Anything But a Newline
Sort by
recency
|
409 Discussions
|
Please Login in order to post a comment
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.
So, it was something as simple as
^...\....\....\....$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\.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.
var pattern = Pattern.compile("...\....\....\....");