Intersection of two regular expressions
Posted
by Henry
on Stack Overflow
See other posts from Stack Overflow
or by Henry
Published on 2010-06-03T14:29:43Z
Indexed on
2010/06/03
14:34 UTC
Read the original article
Hit count: 355
Hi,
Im looking for function (PHP will be the best), which returns true whether exists string matches both regexpA and regexpB.
Example 1: $regexpA = '[0-9]+'; $regexpB = '[0-9]{2,3}';
hasRegularsIntersection($regexpA,$regexpB) returns TRUE because '12' matches both regexps
Example 2: $regexpA = '[0-9]+'; $regexpB = '[a-z]+';
hasRegularsIntersection($regexpA,$regexpB) returns FALSE because numbers never matches literals.
Thanks for any suggestions how to solve this.
Henry
© Stack Overflow or respective owner