3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "[[some_non-matching_text]] [[https://example.com|link]] [[this is not matching either]] [[http://example2.com|link2]]"; echo preg_replace('~\[\[((?:(?!\[\[).)*?)\|(.*?)]]~s', '<a href="$1">$2</a>', $string);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YJ2eQ
function name:  (null)
number of ops:  8
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%5Bsome_non-matching_text%5D%5D+%5B%5Bhttps%3A%2F%2Fexample.com%7Clink%5D%5D+%5B%5Bthis+is+not+matching+either%5D%5D+%5B%5Bhttp%3A%2F%2Fexample2.com%7Clink2%5D%5D'
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%7E%5C%5B%5C%5B%28%28%3F%3A%28%3F%21%5C%5B%5C%5B%29.%29%2A%3F%29%5C%7C%28.%2A%3F%29%5D%5D%7Es'
          3        SEND_VAL                                                 '%3Ca+href%3D%22%241%22%3E%242%3C%2Fa%3E'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ECHO                                                     $2
          7      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.71 ms | 943 KiB | 14 Q