As the name already says, the intersection will intersect two regular expressions. That is, the intersection of n regular expressions is a regular expression that will match if all n subexpressions also give match .
> der match and the regular expression b does not match.
In the case of expression [a-z&&[aeiou]]
, String
a
gives match in the a-z
subexpression and also gives match in the [aeiou]
subexpression. Soon it gives match in the expression [a-z&&[aeiou]]
. On the other hand, String
b
only gives match in the first subexpression, so it does not match match in the complete expression.
In the case of expression [a-z&&[^m-p]]
, String
a
gives match in the subexpression a-z
and also gives match in the [^m-p]
subexpression (because a
is not between m
and p
). Soon it gives match in the expression [a-z&&[^m-p]]
. On the other hand, String
gives match in the first subexpression but does not match the second because m
is between m
and m
, so it does not match in the full expression.