For example, there is such a regular season.

Accepts only one digit:

/([0-9]{,1})/ 

And there is such, takes from 2 to 3 digits

 /([0-9]{2,3})/ 

They will never intersect, that which one will regard as truth will never become truth for another

But there is such an option:

 /([0-9]{2,3})/ /([a-z0-1]{1,3})/ 

And they intersect as soon as the second will be from 2 to 3 digits: 00, 01, 10, 11

  • By the way, the first regular season is generally wrong. There will be no coincidences. - MaximPro
  • If you want something tricky, then you need to parse the regular expression itself and write logic when the intersection happens and when not. A simpler way: check the string for these 2 regular sessions - MaximPro
  • one
    You are probably trying to solve the problem with the wrong means. I do not even know where to use this thrash, since there are no more options. - user207618
  • Well, I just want the routers of the modules not to conflict - Fangog
  • And how can they conflict? and from where does the model have a router? - Naumov

1 answer 1

For the correct construction of operations on sets, you should decide on the universe, that is, the set of admissible elements. And this is not scholasticism, because without a universe there are difficulties with the operation of adding (negating) sets, which is also relevant for regular expressions.

In this case, one can always check the "intersection of regular expressions" by iterating over a universe (or its test subset - on a limited alphabet or with a limited length of expressions), although in simple cases it is possible to get by with logic.