i try to extract a portion of text between 2 tag [ code ][ /code ]
i use this:
$tmp = $_POST[message];
preg_match("/[code].*[\/code]/is", $tmp, $matches);
this work if i have only 1 occurence of the tag but if i more this don'T work, example:
text, text, text
[ code ]
// some code
[ /code ]
text, text, text
[ code ]
// another code part
[ /code ]
text, text, text
when i use the regexp above this extract all between the 1st [ code ] and the 2nd [ /code ]
what should i modify to extract both code block separatly ?
- i use space between [code] braket just for this post otherwise the tag dispear, in my real file there is no space 🙂