[clug] OT meta-regex question

Gough, Chris Chris.Gough at cit.act.edu.au
Tue Feb 3 03:24:22 GMT 2004


...an off topic question, in search of guru guidance

I want a function that tells me if there exists a pattern (anywhere in the
universe strings) that will be matched by both of a pair a pair of regular
expressions. I have wracked my brains and all it achieved was to made the
phrase "finite automata" and the name "Henry Spencer" glow faintly on the
cusp of my consciousness, but I'm no closer to a solution. I can't even
think of a way to pose the question to Google.

I don't care what the pattern/s is/are, I just want to know for sure if one
(or more) exists. I'm not certain there is a solution, but I sure can't wait
forever to crawl through all possible strings to find out. I don't want some
kludge like limiting my string size (then trawling) or inventing my own
quasi-regex pattern matching system.

For example:
 A = '^.*$'
 B = '^foo$'
 // this will return true, because both will match the string 'foo'
 aPatternExists( A, B )
 A = '^foo$'
 B = '^bar$'
 // this will return false, since no string is both 'foo' and 'bar'
 aPatternExists( A, B )
 A = 'foo'
 B = 'bar'
 // this will return true, since both A and B will match (for example)
'foobar'
 aPatternExists( A, B )

My head hurts. If anyone out there can shed some light on this, it would
realy make my day.
TIA

Chris Gough



This email, and any attachments, may be confidential and also privileged.
If you are not the intended recipient:

Please notify the sender and delete all copies of this transmission along
with any attachments immediately.
You should not copy or use it for any purpose, nor disclose its contents to
any other person.


More information about the linux mailing list