^ means from the start of the string, not in the middle or something.
(?:\+(?!0)|(?:0){2})
Brackets have two uses. One to group bits of the expression together, the other to capture the match into a memory. ?: at the start of a bracketed bit turns off the memory aspect of that particular bracket bit.
\+ simply means match a plus sign (a plus sign not proceeded by \, regexās escape character, means something else). The (?!0) bit following on says ānot followed by a zeroā.
So \+(?!0) matches: a + not followed by a zero
| means āorā: \+(?!0) OR (?:0){2} ā the brackets containing the | mark the limit of the or.
(?:0){2} - the ?: again turns off the memory aspect of that bracket set. 0 is literally a zero. {2} says two. That is, match two zeros.
\d{11,16} - \d means 1 digit, 0 to 9. With {11,16} after it, it says match between (inclusively) 11 and 16 digits.
$ means up to the end of the string, not up to the middle or something - no junk after the last bit of the match, 11-16 digits in this case.
In this case I am making the first character of part 2 a digit 1 - 9 (i.e. excluding zero), then reducing the number of digits (\d) that may follow to between 10 and 15.
Matches:
+95215487511
0041587695157
Doesnāt match:
+00654718529
000213256498785
@Jeff_Mott@johnyboy
Do you think that this is the best/cleanest way to go about things?
Ideally I would like to write āany digit, where the first digit is not zero, 11 to 16 timesā