The two regexes:
regex_1 = /^A+\S{2}$/
regex_2 = /^AB+\d{1}$/
match the following ten strings:
AB0
AB1
AB2
AB3
AB4
AB5
AB6
AB7
AB8
AB9
Is there a way to find strings that match two regular expressions that are given?
I have a regex, and it will be sliced to many sub-regexes as follows.
Example 1:
original_regex = /^A+\S{2}$/
sub_regex1 = /^AB+\S{1}$/
sub_regex2 = /^AC+\S{1}$/
Example 2:
original_regex = /^598+\S{5}$/
sub_regex1 = /^598A+\S{4}$/
sub_regex2 = /^598AB+\S{3}$/
I want to know whether there are any strings that match all sub-regexes.
I am thinking to convert the regex to a string and compare the minimal-length prefix and the minimal-length suffix like this:
regex_1 = "/^A+\S{2}$/"
regex_2 = "/^AB+\d{1}$/"
regex_3 = "/^AC+\d{1}$/"
minimal_prefix = "/^A"
Any regex string that contains minimal_prefix
has a string that matches all sub-regexes. I am figuring out whether this is correct or not.