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
|
407 Discussions
|
Please Login in order to post a comment
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("...\....\....\....");