protected function matchXPathForExport($expr)
	{
		$tokenExprs = [
			'(?<current>\\bcurrent\\(\\))',
			'(?<param>\\$\\w+)',
			'(?<fragment>"[^"]*"|\'[^\']*\'|.)'
		];
		preg_match_all('(' . implode('|', $tokenExprs) . ')s', $expr, $matches, PREG_SET_ORDER);

		// Merge fragment tokens
		$i = count($matches);
		while (--$i > 0)
		{
			if (isset($matches[$i]['fragment'], $matches[$i - 1]['fragment']))
			{
				$matches[$i - 1]['fragment'] .= $matches[$i]['fragment'];
				unset($matches[$i]);
			}
		}

		return array_values($matches);
	}
protected function matchXPathForExport($expr)
	{
		$tokenExprs = [
			'(?<current>\\bcurrent\\(\\))',
			'(?<param>\\$\\w+)',
			'(?<fragment>"[^"]*"|\'[^\']*\'|.)'
		];
		preg_match_all('(' . implode('|', $tokenExprs) . ')s', $expr, $matches, PREG_SET_ORDER);

		// Merge fragment tokens
		$i = count($matches);
		while (--$i > 0)
		{
			if (isset($matches[$i]['fragment'], $matches[$i - 1]['fragment']))
			{
				$matches[$i - 1]['fragment'] .= $matches[$i]['fragment'];
				unset($matches[$i]);
			}
		}

		return array_values($matches);
	}
protected function matchXPathForExport ( $ expr ) { $ tokenExprs = [ '(?<current>\\bcurrent\\(\\))' , '(?<param>\\$\\w+)' , '(?<fragment>"[^"]*"|\'[^\']*\'|.)' ] ; preg_match_all ( '(' . implode ( '|' , $ tokenExprs ) . ')s' , $ expr , $ matches , PREG_SET_ORDER ) ; // Merge fragment tokens $ i = count ( $ matches ) ; while ( -- $ i > 0 ) { if ( isset ( $ matches [ $ i ] [ 'fragment' ] , $ matches [ $ i - 1 ] [ 'fragment' ] ) ) { $ matches [ $ i - 1 ] [ 'fragment' ] .= $ matches [ $ i ] [ 'fragment' ] ; unset ( $ matches [ $ i ] ) ; } } return array_values ( $ matches ) ; }
Match the relevant components of an XPath expression

@param  string $expr XPath expression
@return array
Match the relevant components of an XPath expression