有人可以告诉我如何使用正则表达式从字符串中获取“ 123”:
... /组/ 123_abc / ...
我确定
/组/
在该字符串中是唯一的。
(?<=groups\/)\d+
试试看。看演示。
https://regex101.com/r/sJ9gM7/57
$re = "/(?<=groups\\/)\\d+/im";
$str = ".../groups/123_abc/...";
preg_match_all($re, $str, $matches);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句