How to use A regular expression to determine whether it is within the matching range of B regular expression?

there are two Pattern as follows

String pattern1 = "A775[0-9A-Z]";
String pattern2 = "A7750|A7756";

how can I use java to determine that the matching range of pattern2 is within the range of pattern1?
Please take a look at it

Mar.03,2021

if you have enough data sample strings, you can compare them with statistical ideas, that is, use these two patterns to match all samples, get two matching result sets, and then compare the result sets with set operations.


traditional methods are difficult to do, and such problems can be solved through in-depth learning and neural network models (you can try google's tensorflow). But there are two difficulties (actually manpower):

  • enough learning samples, that is, regular expressions, in pairs, to tell the model the result, inclusive or non-inclusive
  • after the preliminary training is completed, enter the test data with pairwise regular expressions as a pair. You can check the results manually without adding a correction
  • .

when there are enough samples and the model training reaches a certain level, the "network model" has the reasoning of judging whether pairwise regular expressions are included

.

there is no easy way to do this, you must parse it yourself. But it's very difficult (it's okay if it's just your example, but it's very difficult if it's universal)


so to speak, it can't be done

.
Menu