3v4l.org

run code in 300+ PHP versions simultaneously
<?php $texts = ["Disposizione n. 158 del 28.1.2012", "Disposizione n.66 del 15.1.2006","Disposizione f_n_66 del 15.1.2001", "Disposizione numero 66 del 15.1.2018", "Disposizione nr. 66 del 15.1.2017", "Disposizione nr_66 del 15.1.2016", "Disposizione numero_66 del 15.1.2005"]; foreach ($texts as $text) { if (preg_match('~(?<![^\W_])n(?:r?[_.]|umero_?)\s*\K\d+~i', $text, $match)) { echo $match[0] . " found in '$text'" . PHP_EOL; } else echo "No match in $text!\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 22
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/jXOdP
function name:  (null)
number of ops:  24
compiled vars:  !0 = $texts, !1 = $text, !2 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1      > FE_RESET_R                                       $4      !0, ->22
          2    > > FE_FETCH_R                                               $4, !1, ->22
    5     3    >   INIT_FCALL                                               'preg_match'
          4        SEND_VAL                                                 '%7E%28%3F%3C%21%5B%5E%5CW_%5D%29n%28%3F%3Ar%3F%5B_.%5D%7Cumero_%3F%29%5Cs%2A%5CK%5Cd%2B%7Ei'
          5        SEND_VAR                                                 !1
          6        SEND_REF                                                 !2
          7        DO_ICALL                                         $5      
          8      > JMPZ                                                     $5, ->17
    6     9    >   FETCH_DIM_R                                      ~6      !2, 0
         10        ROPE_INIT                                     3  ~8      '+found+in+%27'
         11        ROPE_ADD                                      1  ~8      ~8, !1
         12        ROPE_END                                      2  ~7      ~8, '%27'
         13        CONCAT                                           ~10     ~6, ~7
         14        CONCAT                                           ~11     ~10, '%0A'
         15        ECHO                                                     ~11
    5    16      > JMP                                                      ->21
    7    17    >   ROPE_INIT                                     3  ~13     'No+match+in+'
         18        ROPE_ADD                                      1  ~13     ~13, !1
         19        ROPE_END                                      2  ~12     ~13, '%21%0A'
         20        ECHO                                                     ~12
    4    21    > > JMP                                                      ->2
         22    >   FE_FREE                                                  $4
    8    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.05 ms | 1427 KiB | 14 Q