3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/^(?=.{8,12}$)(?=[^A-Z]*[A-Z])(?=\D*\d)(?=(?:[^a-z]*[a-z]){3})(?=[^\s#*.!?$]*[#*.!?$])(?!.*(.)\1)(?:[a-z]|[A-Z])[a-zA-Z0-9#*.!?$,]+$/m'; $str = 'Abcd123!, Abcd123!, abcD123!,dfe abcD123,dfe abcD122!,dfe'; preg_match_all($re, $str, $matches); print_r($matches[0]); $strings = [ "Abcd123!,", "Abcd123!,", "abcD123!,dfe", "abcD123,dfe", "abcD122!,dfe" ]; $re2 = '/^(?=.{8,12}$)(?=[^A-Z]*[A-Z])(?=\D*\d)(?=(?:[^a-z]*[a-z]){3})(?=[^\s#*.!?$]*[#*.!?$])(?!.*(.)\1)(?:[a-z]|[A-Z])[a-zA-Z0-9#*.!?$,]+$/'; foreach ($strings as $string) { if (preg_match($re2, $string)) { echo "Match for $string" . PHP_EOL; } else { echo "No match for $string" . PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 30
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 30
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 25
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/Z3rej
function name:  (null)
number of ops:  32
compiled vars:  !0 = $re, !1 = $str, !2 = $matches, !3 = $strings, !4 = $re2, !5 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%5E%28%3F%3D.%7B8%2C12%7D%24%29%28%3F%3D%5B%5EA-Z%5D%2A%5BA-Z%5D%29%28%3F%3D%5CD%2A%5Cd%29%28%3F%3D%28%3F%3A%5B%5Ea-z%5D%2A%5Ba-z%5D%29%7B3%7D%29%28%3F%3D%5B%5E%5Cs%23%2A.%21%3F%24%5D%2A%5B%23%2A.%21%3F%24%5D%29%28%3F%21.%2A%28.%29%5C1%29%28%3F%3A%5Ba-z%5D%7C%5BA-Z%5D%29%5Ba-zA-Z0-9%23%2A.%21%3F%24%2C%5D%2B%24%2Fm'
    4     1        ASSIGN                                                   !1, 'Abcd123%21%2C%0AAbcd123%21%2C%0AabcD123%21%2Cdfe%0A%0AabcD123%2Cdfe%0AabcD122%21%2Cdfe'
   11     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
   12     7        INIT_FCALL                                               'print_r'
          8        FETCH_DIM_R                                      ~9      !2, 0
          9        SEND_VAL                                                 ~9
         10        DO_ICALL                                                 
   15    11        ASSIGN                                                   !3, <array>
   23    12        ASSIGN                                                   !4, '%2F%5E%28%3F%3D.%7B8%2C12%7D%24%29%28%3F%3D%5B%5EA-Z%5D%2A%5BA-Z%5D%29%28%3F%3D%5CD%2A%5Cd%29%28%3F%3D%28%3F%3A%5B%5Ea-z%5D%2A%5Ba-z%5D%29%7B3%7D%29%28%3F%3D%5B%5E%5Cs%23%2A.%21%3F%24%5D%2A%5B%23%2A.%21%3F%24%5D%29%28%3F%21.%2A%28.%29%5C1%29%28%3F%3A%5Ba-z%5D%7C%5BA-Z%5D%29%5Ba-zA-Z0-9%23%2A.%21%3F%24%2C%5D%2B%24%2F'
   24    13      > FE_RESET_R                                       $13     !3, ->30
         14    > > FE_FETCH_R                                               $13, !5, ->30
   25    15    >   INIT_FCALL                                               'preg_match'
         16        SEND_VAR                                                 !4
         17        SEND_VAR                                                 !5
         18        DO_ICALL                                         $14     
         19      > JMPZ                                                     $14, ->25
   26    20    >   NOP                                                      
         21        FAST_CONCAT                                      ~15     'Match+for+', !5
         22        CONCAT                                           ~16     ~15, '%0A'
         23        ECHO                                                     ~16
   25    24      > JMP                                                      ->29
   28    25    >   NOP                                                      
         26        FAST_CONCAT                                      ~17     'No+match+for+', !5
         27        CONCAT                                           ~18     ~17, '%0A'
         28        ECHO                                                     ~18
   24    29    > > JMP                                                      ->14
         30    >   FE_FREE                                                  $13
   30    31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.55 ms | 1009 KiB | 16 Q