I would not attempt to do this with a single regular expression. There is far too much variance in the input. I would clean up the text like this:
$text = '
AB01234 This could be a
long question with multiple
new lines a)these b)are c)the responses which could
contains new lines d)either b
AB01235 This is another question with same multiple
response a) one b) two c) three d) four c
';
$text = preg_replace('/([A-Z]{2}[0-9]{5})/', ' QUESTION\1 ', $text);
$text = preg_replace('/([a-z]\))/', ' ANSWER\1 ', $text);
$text = trim(preg_replace('/\s+/', ' ', $text));
print($text);
You will see that the text is now rather clean. It is one line. Spacing is cleaned up. You also have clear flags for QUESTION and ANSWER. You can change those to anything you like, such as !@#$#@!# for a question. They just have to be something that will not ever appear in the text.
Now, you could try a regular expression, but explode is easier at this point because you flagged the delimiters. I used explode and implode a lot in this example, just in case you haven't seen it much. You don't have to use it. You could use regex or substrings.
$questions = array();
$qas = explode("QUESTION", $text);
foreach($qas as $qa)
{
if($qa == "") continue;
$answers = explode("ANSWER", $qa);
$q = array();
foreach($answers as $i=>$answer)
{
$a = explode(' ', $answer);
if($i == 0) $q[] = $a[0];
$questions[0] = $a[0];
array_shift($a);
$q[] = implode(' ', $a);
}
$questions[] = $q;
}
print_r($questions);
Now, you should have an array that you want.