What's the regex to solve this problem?

Posted by Yeti on Stack Overflow See other posts from Stack Overflow or by Yeti
Published on 2010-06-17T11:57:50Z Indexed on 2010/06/17 12:03 UTC
Read the original article Hit count: 292

Filed under:
|

I have an array in PHP with URLs like below:

http://example.com/apps/1235554/
http://example.com/apps/apple/
http://example.com/apps/126734
http://example.com/images/a.jpg
http://example.com/images/b.jpg
http://example.com/apps/2331234/
http://example.com/apps/orange/

How can I separate out these urls and push them to another array using Regex:

http://example.com/apps/1235554/
http://example.com/apps/126734
http://example.com/apps/2331234/

Only url with apps/{number}/ and apps/{number} should be selected.

© Stack Overflow or respective owner

Related posts about php

Related posts about regex