My php code:
      $exp = 'zzz<pre>sssss<pre>fff</pre>ff</pre>zzz';     
      \preg_match_all("#<pre>((?>[^(?:<pre>)(?:</pre>)]|(?R))*)</pre>#si", $exp, $matches);
        $i = 0;
        foreach ($matches as $item) {           
            foreach ($item as $elem)
            {
                echo "$i  ", \htmlentities($elem), "<br>";
            }
            $i++;
        }
Output:
0
<pre>sssss<pre>fff</pre>ff</pre>1
sssss<pre>fff</pre>ff
That is good - regex works and finds nested tags <pre>. But I have one problem:
[^(?:<pre>)(?:</pre>)]
I can set a dismath with charaters < / p r e >, but I need to set a dismach with strings <pre> and </pre>. Therefore, if I add in the original text at least the symbol p or r, regex do not work as it should.
Example:  $exp = zzz<pre>ssspss<pre>fff</pre>ff</pre>zzz; // p inside ssspss
Output
0
<pre>fff</pre>1
fff
Tell me, how to build the regular expression to set a mismatch with the string, rather than individual characters?
 
     
    