Can someone tell me how to get "123" out of this string with regex:
.../groups/123_abc/...
I am sure that
/groups/
is unique in that string.
(?<=groups\/)\d+
Try this.See demo.
https://regex101.com/r/sJ9gM7/57
$re = "/(?<=groups\\/)\\d+/im";
$str = ".../groups/123_abc/...";
preg_match_all($re, $str, $matches);