On 11 June 2014 13:23:14 BST, BrJohan <brjo...@gmail.com> wrote: >For some genealogical purposes I consider using Python's re module. > >Rather many names can be spelled in a number of similar ways, and in >order to match names even if they are spelled differently, I will build > >regular expressions, each of which is supposed to match a number of >similar names.
As has been mentioned, you probably want to look at fuzzy matching algorithms rather than aiming at regular expressions, although a quick search suggests there has been some work on fuzzy matching with regular expressions[1]. >Now, my problem: Is there a way to decide whether any two - or more - >of >those regular expressions will match the same string? If your regexes are truly regular expressions (see [2]*) then they represent regular languages[3], which are really sets. The intersection of these, is another regular language. If you test the string against this it will also match both original languages. (*this only mentions back references, but I think the look-ahead/behind assertions are also non-regular) [1]: http://laurikari.net/tre/about/ [2]: https://en.wikipedia.org/wiki/Regular_expression#Patterns_for_non-regular_languages [3]: https://en.wikipedia.org/wiki/Regular_language Simon -- Sent from Kaiten Mail. Please excuse my brevity. -- https://mail.python.org/mailman/listinfo/python-list