3v4l.org

run code in 500+ PHP versions simultaneously
<?php $re = '/\[[^][\d]*\K\d+(?:\.\d+)?(?=[^][]*])/'; $str = 'I have the following expression [+₪7.00], I wish to extract only 7.00 or 7.'; if (preg_match_all($re, $str, $matches)) { print_r($matches[0]); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/fnF7G
function name:  (null)
number of ops:  13
compiled vars:  !0 = $re, !1 = $str, !2 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%2F%5C%5B%5B%5E%5D%5B%5Cd%5D%2A%5CK%5Cd%2B%28%3F%3A%5C.%5Cd%2B%29%3F%28%3F%3D%5B%5E%5D%5B%5D%2A%5D%29%2F'
    4     1        ASSIGN                                                       !1, 'I+have+the+following+expression+%5B%2B%E2%82%AA7.00%5D%2C+I+wish+to+extract+only+7.00+or+7.'
    5     2        INIT_FCALL                                                   'preg_match_all'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        SEND_REF                                                     !2
          6        DO_ICALL                                             $5      
          7      > JMPZ                                                         $5, ->12
    6     8    >   INIT_FCALL                                                   'print_r'
          9        FETCH_DIM_R                                          ~6      !2, 0
         10        SEND_VAL                                                     ~6
         11        DO_ICALL                                                     
    7    12    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.94 ms | 1983 KiB | 15 Q