I think this would read better as:
```php
$hasMatch = preg_match( $pattern, $url, $matches );
if ( $hasMatch ) { ... }
```