I'm trying to match substrings that are enclosed in %'s but preg_match_all seems to include several at the same time in the same line.
Code looks like this:
preg_match_all("/%.*%/", "%hey%_thereyou're_a%rockstar%\nyo%there%", $matches);
print_r($matches);
Which produces the following output.
Array
(
    [0] => Array
        (
            [0] => %hey%_thereyou're_a%rockstar%
            [1] => %there%
        )
)
However I'd like it to produce the following array instead:
[0] => %hey%
[1] => %rockstar%
[2] => %there%
What am I missing?