Created
February 27, 2018 08:50
-
-
Save miholeus/3eeb56db7642b21d785b3feeee047b54 to your computer and use it in GitHub Desktop.
regex route
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$regex = '#^(?|/foo(\d+)(*MARK:16) | |
|/foo(\w+)(*MARK:41) | |
)$#x'; | |
preg_match($regex, '/footest', $matches); | |
var_dump($matches); | |
$m = $matches['MARK']; | |
$regex = substr_replace($regex, 'FAIL', $m, 5+strlen($m)); | |
var_dump($regex); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment