标签: php preg-match
如何匹配特定数量的十进制字符?
preg_match('/([0-9]{15,16})[^0-9]/', $input, $matches))
no. 05485845150270008225169 => NO MATCH! no. 50270008225169 => NO MATCH! FI 150270008225169 => MATCH! FI 5150270008225169 => MATCH!
答案 0 :(得分:1)
为模式添加外观,以匹配不超过16位的数字:
(?<!\d)\d{15,16}(?!\d)
https://regex101.com/r/aO0tA5/1