preg_match("/(11|10|12)([*0-9]+)/i", "11*&!@#")
上は私が試したものです。
私の要件は合計6文字です。
10****
102***
1023**
10234*
102345
最初の 2 文字は 10 または 11 または 12 のいずれかで、残りの 4 文字は上記のパターンのようにする必要があります。
どうすれば達成できますか?
1[0-2][0-9*]{4}
This should met your requirements:
1
at the begining0
or 1
or 2
*
, four timesEDIT
To avoid inputs like 102**5
you can do the pattern more complex:
1[0-2](([*]{4})|([0-9][*]{3})|([0-9]{2}[*]{2})|([0-9]{3}[*])|([0-9]{4}))
Like this:
#(10|11|12)([0-9]{4})#
Outputs: