Ok, so i have a string like this
$sText = '[post:1]Some test here......[/post]';
now i want to extract the text within this that is "Some test here......" and i also want the number "1" next inside the bracket [post:1]. I have tried searching for a solution but couldn't find a good one yet.
I tried to get the text inside the brackets with this
preg_match_all('/\[(.*?)\]/', $sText, $out);
and it gives me this
Array
(
[0] => Array
(
[0] => [post:1]
[1] => [/post]
)
[1] => Array
(
[0] => post:1
[1] => /post
)
)
I can get the number from that using explode or by any other means then i could probably get the text by using regex to remove the brackets but that sounds like too much regex. Is there any better solution/idea for this? Well i am not good with regex.