3v4l.org

run code in 300+ PHP versions simultaneously
<?php //(?=) - positive lookahead $string = "achei quebra; tem aqui;"; $regex = "/\w+(?=;)/"; preg_match_all($regex, $string, $matches); var_dump($matches); //(?!) - negative lookahead / $regex = "/\b\w+\b(?!;)/"; preg_match_all($regex, $string, $matches); var_dump($matches); //(?<=) - positive lookbehind $string = "dra Julia \ndr Marcos \ndr Mateus \ndra Ana"; $regex = "/(?<=dra\s)(\w+)/im"; preg_match_all($regex, $string, $matches); var_dump($matches); //(?<!) - negative lookbehind $regex = "/(?<!^dra\s)\b\w+\b$/im"; preg_match_all($regex, $string, $matches); var_dump($matches); /* (?>) - atomic group */
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y5Jnd
function name:  (null)
number of ops:  39
compiled vars:  !0 = $string, !1 = $regex, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'achei+quebra%3B+tem+aqui%3B'
    4     1        ASSIGN                                                   !1, '%2F%5Cw%2B%28%3F%3D%3B%29%2F'
    5     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
    6     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
    9    10        ASSIGN                                                   !1, '%2F%5Cb%5Cw%2B%5Cb%28%3F%21%3B%29%2F'
   10    11        INIT_FCALL                                               'preg_match_all'
         12        SEND_VAR                                                 !1
         13        SEND_VAR                                                 !0
         14        SEND_REF                                                 !2
         15        DO_ICALL                                                 
   11    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
   14    19        ASSIGN                                                   !0, 'dra+Julia+%0Adr+Marcos+%0Adr+Mateus+%0Adra+Ana'
   15    20        ASSIGN                                                   !1, '%2F%28%3F%3C%3Ddra%5Cs%29%28%5Cw%2B%29%2Fim'
   16    21        INIT_FCALL                                               'preg_match_all'
         22        SEND_VAR                                                 !1
         23        SEND_VAR                                                 !0
         24        SEND_REF                                                 !2
         25        DO_ICALL                                                 
   17    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
   20    29        ASSIGN                                                   !1, '%2F%28%3F%3C%21%5Edra%5Cs%29%5Cb%5Cw%2B%5Cb%24%2Fim'
   21    30        INIT_FCALL                                               'preg_match_all'
         31        SEND_VAR                                                 !1
         32        SEND_VAR                                                 !0
         33        SEND_REF                                                 !2
         34        DO_ICALL                                                 
   22    35        INIT_FCALL                                               'var_dump'
         36        SEND_VAR                                                 !2
         37        DO_ICALL                                                 
   28    38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.41 ms | 1401 KiB | 17 Q