Let's say the phone number has to be three numbers long. We can do it like \d\d\d
or \d{3}
. This is clear to me. We also can say it has to start with three numbers like ^\d{3}
. And that it ends to three numbers with \d{3}$
. And both with ^\d{3}$
. So far this is clear to me. But the thing I fail to understand is that why this does not match: "123asd456"? It matches the rules, because 1) It starts with three digits and 2) it ends to three digits. What part there says that "yeah but the LENGTH has to be exactly three"?
And yeah, I tested (with c#) that it fails to match, I just don't understand why.