Regular Expression: How the rule is applied for the Pattern'/((red|white) (king|queen))/'
Can any one explain how the rule is applied for the following Regular
expression
$Str = 'the red king';
$Pattern = '/((red|white) (king|queen))/';
preg_match($Pattern,$Str,$Val);
Result:
Array
(
[0] => red king
[1] => red king
[2] => red
[3] => king
)
Thanks in Advance
Moses
|