xref: /PHP-8.3/ext/pcre/tests/006.phpt (revision 782352c5)
1--TEST--
2preg_replace() with array of failing regular expressions
3--INI--
4pcre.jit=0
5pcre.backtrack_limit=100000
6--FILE--
7<?php
8
9$text = '[CODE]&lt;td align=&quot;$stylevar[right]&quot;&gt;[/CODE]';
10$result = preg_replace(array('#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU', '#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU'), '', $text);
11var_dump($text);
12var_dump($result);
13
14$result = preg_replace('#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU', '', $text);
15var_dump($text);
16var_dump($result);
17
18echo "Done\n";
19?>
20--EXPECT--
21string(58) "[CODE]&lt;td align=&quot;$stylevar[right]&quot;&gt;[/CODE]"
22NULL
23string(58) "[CODE]&lt;td align=&quot;$stylevar[right]&quot;&gt;[/CODE]"
24NULL
25Done
26