3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Lazy $rawUrls = <<<EOF http://www.example.com/webapp/some-text.html http://www.example.com/webapp/some-text-a1.html http://www.example.com/webapp/some-a2-text.html http://www.example.com/webapp/first-text-vs-some-text.html http://www.example.com/webapp/first-text-a1-vs-sec-b2-text.html http://www.example.com/webapp/first-text-a1-vs-sec-b2-text-vs-third-c3-text.html http://www.example.com/webapp/some-text-a1-vs-sec-text-b2-vs-third-text-vs-last-text-c1.html EOF; $urls = explode("\n", $rawUrls); //The pattern to match, must have at least one -vs- and above $pattern = '/\/webapp\/(.*)(-vs-.*)+\.html/'; //Match loop foreach($urls as $url) { if (preg_match($pattern, $url)) { echo "Matched $url\n"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 19
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/2gWlN
function name:  (null)
number of ops:  21
compiled vars:  !0 = $rawUrls, !1 = $urls, !2 = $pattern, !3 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fwww.example.com%2Fwebapp%2Fsome-text.html%0Ahttp%3A%2F%2Fwww.example.com%2Fwebapp%2Fsome-text-a1.html%0Ahttp%3A%2F%2Fwww.example.com%2Fwebapp%2Fsome-a2-text.html%0Ahttp%3A%2F%2Fwww.example.com%2Fwebapp%2Ffirst-text-vs-some-text.html%0Ahttp%3A%2F%2Fwww.example.com%2Fwebapp%2Ffirst-text-a1-vs-sec-b2-text.html%0Ahttp%3A%2F%2Fwww.example.com%2Fwebapp%2Ffirst-text-a1-vs-sec-b2-text-vs-third-c3-text.html%0Ahttp%3A%2F%2Fwww.example.com%2Fwebapp%2Fsome-text-a1-vs-sec-text-b2-vs-third-text-vs-last-text-c1.html'
   13     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%0A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
   16     6        ASSIGN                                                   !2, '%2F%5C%2Fwebapp%5C%2F%28.%2A%29%28-vs-.%2A%29%2B%5C.html%2F'
   19     7      > FE_RESET_R                                       $8      !1, ->19
          8    > > FE_FETCH_R                                               $8, !3, ->19
   20     9    >   INIT_FCALL                                               'preg_match'
         10        SEND_VAR                                                 !2
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $9      
         13      > JMPZ                                                     $9, ->18
   21    14    >   ROPE_INIT                                     3  ~11     'Matched+'
         15        ROPE_ADD                                      1  ~11     ~11, !3
         16        ROPE_END                                      2  ~10     ~11, '%0A'
         17        ECHO                                                     ~10
   19    18    > > JMP                                                      ->8
         19    >   FE_FREE                                                  $8
   23    20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
189.01 ms | 1396 KiB | 17 Q