<?php $string = 'bar'; $matches = []; preg_match('~(?|foo(*:1) |bar(*:2) |baz(*:3))~x', $string, $matches); var_dump($matches);
You have javascript disabled. You will not be able to edit any code.