Skip to content

Instantly share code, notes, and snippets.

@lemon-tree
Created December 11, 2011 18:19
Show Gist options
  • Save lemon-tree/1461911 to your computer and use it in GitHub Desktop.
Save lemon-tree/1461911 to your computer and use it in GitHub Desktop.
Matching
<?php
$string = '/index/hi
/user/dfhds
/register/ddd
/etc/blah
/etc/';
preg_match_all("/^\/(?!(user|index|register))\w+\/\w*$/m", $string, $matches);
print_r($matches);
//Array
//(
// [0] => Array
// (
// [0] => /etc/blah
// [1] => /etc/
// )
//
// [1] => Array
// (
// [0] =>
// )
//
//)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment