Skip to content

Instantly share code, notes, and snippets.

@miholeus
Created February 27, 2018 08:50
Show Gist options
  • Save miholeus/3eeb56db7642b21d785b3feeee047b54 to your computer and use it in GitHub Desktop.
Save miholeus/3eeb56db7642b21d785b3feeee047b54 to your computer and use it in GitHub Desktop.
regex route
<?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