使用正则表达式从字符串中获取数字 [英] Get numbers from string with regex
本文介绍了使用正则表达式从字符串中获取数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试编写一个正则表达式来从这些字符串中获取数字:
I am trying to write a regex to get the numbers from strings like these ones:
javascript:ShowPage('6009',null,null,null,null,null,null,null)
javascript:BlockLink('2146',null,null,null)
我很难编写正则表达式来获取这些数字.
I am having difficulty writing the regex to grab these numbers.
我该怎么做?
推荐答案
试试这个:
(\d+)
您使用什么语言来解析这些字符串?
What language are you using to parse these strings?
如果您告诉我,我可以帮助您处理使用此正则表达式所需的代码.
If you let me know I can help you with the code you would need to use this regular expression.
这篇关于使用正则表达式从字符串中获取数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文