import re pattern = r"(,\s*)[^,]*\sAS\b\s*"s = ("Select customer_name, customer_type, COUNT(*) AS volume\\nFROM table\\nGROUP BY customer_name, customer_type\\nORDER BY volume DESC\\nLIMIT 10\n") print(re.sub(pattern, r"\1", s))
Standard input is empty
Select customer_name, customer_type, volume\nFROM table\nGROUP BY customer_name, customer_type\nORDER BY volume DESC\nLIMIT 10
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!