[DomCrawler] Optimize the regex used to find namespace prefixes
This commit is contained in:
parent
f64cf23811
commit
02818e4c92
@ -1036,13 +1036,13 @@ class Crawler extends \SplObjectStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $xpath
|
* @param string $xpath
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function findNamespacePrefixes($xpath)
|
private function findNamespacePrefixes($xpath)
|
||||||
{
|
{
|
||||||
if (preg_match_all('/(?P<prefix>[a-z_][a-z_0-9\-\.]*):[^"\/:]/i', $xpath, $matches)) {
|
if (preg_match_all('/(?P<prefix>[a-z_][a-z_0-9\-\.]*+):[^"\/:]/i', $xpath, $matches)) {
|
||||||
return array_unique($matches['prefix']);
|
return array_unique($matches['prefix']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user