Find two different substr in PHP

Viewed 95

From:

$str = "This is one string with this picture pic1.jpg and here there's another one pic2.png for example"

I want to use something similar to preg_match_all() but I would like to do it just in one line. I want to have in just one array both: [pic1.jpg] and [pic2.png].

Something like this:

preg_match_all(
'/picture (.*) and|one (.*) for/',
$pat,
$matches,
PREG_PATTERN_ORDER));

I know this code is really bad, but I think you have the idea.

2 Answers
Related