Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 15 位数字,后跟一个可以是任意长度的数字。
例如:
15位数字+2位数字;
15位数字+3位数字;
15位号码+10位号码;
如何使用 RegEx 将前 15 位数字捕获为“第 1 部分”,将剩余的数字捕获为“第 2 部分”?
试试这个正则表达式:
^(\d{15})(\d+)$
解释:
^ Start of string $ End of string \d Any digit {15} Repeat 15 times + Repeat one or more times. (...) Capturing group