-
Notifications
You must be signed in to change notification settings - Fork 830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
正则可以按照需求截取一小段字符的部分吗 #25
Comments
好用就行, 你先用着, 我稍后再优化优化, 然后收录到网站 '91110108101966816T'.match(/^\d+(\d{9})/) |
感谢 |
@hpg-github 不客气 |
@hpg-github 最后一位一定是大写字母吗? |
('91110108101966816T').match(/^(?:\d|[A-Z])+((?:\d|[A-Z]){9})(?:\d|[A-Z])$/i) 我有看了看"社会信用代码"的介绍, 你用这个,之前那个不行 |
我刚刚查了查 ,不一定是大写的英文字母 |
@hpg-github 用这个 ('91110108101966816T').match(/^(?:\d|[A-Z])+((?:\d|[A-Z]){9})(?:\d|[A-Z])$/i)[1] |
你在那学的正则 我也想写,我再试试 |
可以了 ,感谢 |
就是看mdn文档, 多写多练, 我也是因为维护这个才用的熟练, 你平时主要工作用正则地方少, 练得少 |
get了,感谢,平时工作确实不怎么用,找个时间看看。 |
将统一社会信用代码进行截取,自倒数第2位数字开始往前共推9位数字。
比如这样: 91110108101966816T ----> 101966816
这样的可以吗 不行只能截取字符串在判断
The text was updated successfully, but these errors were encountered: