You’ll generally get a better answer if you include an example in
your question. Also, that link didn’t work.
If you’re asking how to apply two regexps, you can use the scan
method to get the results in arrays, and then intersect them with &.
This does not help at all as Benjon explains. The question is not
whether
there are some strings in a set of strings that are matched by both RX
but
whether there is at least one string among all possible strings that
is
matched by both.
He now wants to find a regular expression Ri such that:
S(Ri) = S(R1) & S(R2)
No. He wants to know whether S(R1) & S(R2) is not empty. At least
that’s
what he stated. You might be able to solve the problem by finding Ri
but
that was not the original problem stated.
whether there are some strings in a set of strings that are matched by
both RX but whether there is at least one string among all possible
strings that is matched by both.
…
No. He wants to know whether S(R1) & S(R2) is not empty. At least
that’s what he stated. You might be able to solve the problem by
finding Ri but that was not the original problem stated.
Yes, precisely.
I figured out how to do it manually for this application which uses a
simple regex syntax. Doing it for the Regexp class in general would be
quite another thing.
Having now done it, I think it would make a great quiz, with a little
head start (which I am willing to give). Are you listening James?
If anyone’s interested in the solution I came up with let me know.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.