import pyparsing as pp one = pp.Literal("ab").setName("one") two = pp.Literal("aba").setName("two") combined = (one | two) +