What's the defference between ^([1-9]{1,2},){4}[1-9]{1,2}$ and
([1-9]{1,2},){4}[1-9]{1,2}?
If I use ([1-9]{1,2},){4}[1-9]{1,2} to match the input.
1,2,3,4,5,6,7,8,9 would be matched as a valid input.
But, if I add ^ at the beginning and $ at the end. The expression
^([1-9]{1,2},){4}[1-9]{1,2}$ would match below input as I desired.
1,2,3,4,5
My question is: What's the difference between ^([1-9]{1,2},){4}[1-9]{1,2}$
and ([1-9]{1,2},){4}[1-9]{1,2} ? You know, I only add ^ and $.
Could you explain why does the difference happen?
No comments:
Post a Comment