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 give match if all the n subexpressions also give match.
Subtraction of a regular expression to by an expression b will give match only if the expression to der match and the regular expression b don’t give.
In the case of the expression [a-z&&[aeiou]]
, to String
a
gives match in the sub-expression a-z
and also gives match in the sub-expression [aeiou]
. Soon he gives match in the expression [a-z&&[aeiou]]
. On the other hand, the String
b
can only match in the first subexpression, and therefore it does not give match in full expression.
In the case of the expression [a-z&&[^m-p]]
, to String
a
gives match in the sub-expression a-z
and also gives match in the sub-expression [^m-p]
(because a
is not among m
and p
). Soon he gives match in the expression [a-z&&[^m-p]]
. On the other hand, the String
m
gives match in the first subexpression, but does not give match in the second because m
is among m
and p
, and therefore he does not give match in full expression.
What do you want to do?
– stderr
I’m just trying to understand these two guys.
– JBarbosa
You want to know if a regex catch something? if possible explain better what you want to do.
– stderr