[clug] OT meta-regex question

Gough, Chris Chris.Gough at cit.act.edu.au
Tue Feb 3 05:43:29 GMT 2004


>> On Tue, 3 Feb 2004, Gough, Chris wrote:
>>  A = '^.*$'
>>  B = '^foo$'
> and Michael Still replied:
>
> For this simplistic example, you can just strip common starting and
> trailling elements, and then ask if:
>
> .* could match foo
>
> Here the answer is yes. This simple technique falls apart for more complex
> examples though:
<snip>

That's pretty neat. If I manage to reduce one of the regexes to a 'plain
string' before running out of common starting and ending elements, then the
answer I want is the same as:

  does 'remaining regex with possible wildcards' match 'plain string'? easy.

But in cases where I can't reduce at least one of the regexes to a plain
string by stripping common starting and ending elements, I am still left
with my first problem:

  is there a string that will be matched by both regexes? still too hard for
me :(

Can you think of any other tricks like this?

If I keep collecting such tricks, am I going to be able to make a general
solution, or is there always going to be some unsolvable regex pairs?


ChrisThis 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