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.
That is, it must be 4 groups of 3 "anycharacters" delimited by periods. We use . to match "anycharacter" in regex. It matches everything but things like line breaks. And \. matches actual periods in the string. We have to escape the . because it is a metacharacter. So, in the solution, we're saying that between the beginning of the string ^ and the end of the string $ there will be exactly 4 groups of 3 "anycharacters" delimited by periods.
Matching Anything But a Newline
You are viewing a single comment's thread. Return to all comments →
The solution explained, piece by piece.
The solution:
^...\....\....\....$
This pattern expects strings like:
111.222.333.444
111.111.111.111
aaa.aaa.aaa.aaa
AAA.AAA.BBB.BBB
abd.ghj.999.1n4
That is, it must be 4 groups of 3 "anycharacters" delimited by periods. We use
.
to match "anycharacter" in regex. It matches everything but things like line breaks. And\.
matches actual periods in the string. We have to escape the.
because it is a metacharacter. So, in the solution, we're saying that between the beginning of the string^
and the end of the string$
there will be exactly 4 groups of 3 "anycharacters" delimited by periods.