Serhiy Storchaka added the comment: The simple way is just write all possible variants ('ENABLE.*NOAUTH|NOAUTH.*ENABLE').
The general way is to use itertools.permutations(): pattern = '|'.join(map('.*'.join, permutations(map(re.escape, strings)))) See also similar problem in issue19681. The first my patch used permutations(). But there was committed the patch with manually written variants. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27132> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com