标签: php preg-replace
我想从我拥有的RSS提要链接中提取数字(以粗体显示)。如何使用preg_match()实现它?
preg_match()
....com/photo/51671645.cms
答案 0 :(得分:-1)
只需使用这个简单的模式com/photo/(\d+).cms:
com/photo/(\d+).cms
preg_match('|com/photo/(\d+).cms|', 'com/photo/51671645.cms', $matches); $number = $matches[1];