I'm developing an Authorization system and I'm stuck on the regex part of it.

I have a file containing all of the places that a person is allowed to go:
PHP Code:
global $roles;

$roles['god'] = array(
     
'paths' => array(
          
"/",
          
"/index/helloworld/"
     
)
); 
Now when the page loads I need to compare the uri to the role of the user:
PHP Code:
foreach ($roles['god']['paths'] as $path) {
     
/* compare uri to the path */

That's where I get stuck, I'm not sure on how to compare both paths.
Thanks in advance for any help.