使用正则表达式替换段落标记

I need to take the output of $one and make an array, however, the regex is not right because all I get back is an array with one key and one value; basically, the entire string. If there are 10 paragraph tags in the string then I should get 10 values in the array.

What is wrong with my regex?

Ideally, what I would like to have in the output array are two arrays, one with the paragraph tags and another with just the text between them.

$one = preg_replace( '/<p>/i', '<p class="test">', $str ); // This gives me what I need
print_r(explode( '/<p class="test">/iU', $one )); // This does not

The problem is simple. Explode does not use regex. This should work for you.

print_r(explode('<p class="test">', $one ));

EDIT: This ought to do what you want.

$pattern = '/(?P<open><p class="test">)'
          . '(?P<content>.*)'
          . '(?P<close><\/p>)/i';
preg_match_all($pattern, $one, $matches);
print_r($matches);

EDIT: Simplified version without the match tags:

$pattern = '/(<p class="test">)(.*)(<\/p>)/i';
preg_match_all($pattern, $one, $matches);
print_r($matches);