Regex fix for this? [extension]
- by Yeti
Sorry for the redundancy, I should've asked this in my previous question here: http://stackoverflow.com/questions/3061407/whats-the-regex-to-solve-this-problem
This question is an extension:
From the elements in an array below:
http://example.com/apps/1235554/
http://example.com/apps/apple/
http://example.com/apps/126734
http://example.com/images/a.jpg
I'm separating out apps/{number}/ and apps/{number} using:
foreach ($urls as $url)
{
if (preg_match('~apps/[0-9]~', $url)) echo $url;
}
Now, how do I also push {number} to another array with the same regex?