fork(4) download
  1. <?php
  2. $subject = "{ toto}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid5517131 [[}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid2708730 Foo}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid2708730 Buzz}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid5517131 ]]} {toto}";
  3. $pattern = '/{[^{]*\[{2}.*?\b(\w+)}.*?(?:\b(\w+)}.*?)?\]{2}[^}]*}/';
  4. preg_match($pattern, $subject, $matches);
  5. print_r($matches);
  6. ?>
Success #stdin #stdout 0.02s 13064KB
stdin
Standard input is empty
stdout
Array
(
    [0] => {
tlchcs1 \af0 \ltrchcs0 \insrsid5517131 [[}{
tlchcs1 \af0 \ltrchcs0 \insrsid2708730 Foo}{
tlchcs1 \af0 \ltrchcs0 \insrsid2708730 Buzz}{
tlchcs1 \af0 \ltrchcs0 \insrsid5517131 ]]}
    [1] => Foo
    [2] => Buzz
)