I have a list of strings that include some regular expressions-like strings that define ALL possible matches to form new strings. Example:
Source
Id[0-1][2-3]_Pos[1-3]
foo01_bar[A-C]
Is there any way in Python I can loop trough all possibilities and create new strings from it? So, the example above shall deliver:
Target
Id02_Pos1
Id02_Pos2
Id02_Pos3
Id03_Pos1
Id03_Pos2
Id03_Pos3
Id12_Pos1
Id12_Pos2
Id12_Pos3
Id13_Pos1
Id13_Pos2
Id13_Pos3
foo01_barA
foo01_barB
foo01_barC
Any hints are welcomed.
Update:
A working example of the answer can be found here: http://pyparsing.wikispaces.com/file/view/invRegex.py