I’m trying to create a url handler and I tried to use preg_match for finding the variables.
So here is the preg_match that I get after the variable replacing of the url format (ex:post/%id%/%title%) –
preg_match("/post\/[0-9]+\/[a-z-א-ת-]+/i","post/5/lol",$match);
My problem that $match returns only this inside array –
“post/5/lol”
And not an array like that –
Array (
[0] => "post/5/lol",
[1] => "5",
[2] => "lol"
)
Can someone help me please to find out why it returns only one match?
Wrap each segment you wish to capture with parentheses, creating sub-expressions: