Regex grouping doesn't seem to work in preg_match_all ()

I recently played with regular expressions, and one thing does not work as expected for me when I use preg_match_all in php.

I am using the regex online tool at http://www.solmetra.com/scripts/regex/index.php .

I use regex /(?>x|y|z)w/. I make it match with abyxw. I expect him to fail, but he will succeed and be consistent xw.

I expect it to fail due to the use of the atomic group, which, from what I read from several sources, prevents rollback. I definitely expect the engine to try yalternating and succeeding. He later tries to match a wregular expression literal wand fails because he encounters x. Then, as a rule, it recedes, but in this case it should not be connected with the atomic grouping. Therefore, from what I know, he should continue to try to correlate ywith this atomic group. But this is not so.

I would appreciate any light in this situation. :)

+5
source share
1 answer

, , , :

  • . i, , i+1, , .
  • Backtracking. , , .

, .

, y , xw , .

+4

All Articles