I have a string like this
SELECT [Orders$].[Category] AS [Category],
,
, [Orders$].[City] AS [City],
,
, [Orders$].[Country] AS [Country],
,
, [Orders$].[Customer ID] AS [Customer ID],
,
, [Orders$].[Customer Name] AS [Customer Name],
,
, [Orders$].[Discount] AS [Discount],
,
, [Orders$].[Profit] AS [Profit],
,
, [Orders$].[Quantity] AS [Quantity],
,
, [Orders$].[Region] AS [Region],
,
, [Orders$].[State] AS [State],
,
, [People$].[Person] AS [Person],
,
, [People$].[Region] AS [Region (People)]
,
,FROM [Orders$]
,
, INNER JOIN [People$] ON [Orders$].[Region] = [People$].[Region]
I want to get only Category and city dynamically without hardcoding the word . What kind of pattern should i use ?? So that i will store those two values in an array which is looped in downstream program .
I tried splitting the text
colName = re.split("\W+", result)
['SELECT',
'Orders',
'Category',
'AS',
'Category',
'13',
'10',
'Orders',
'City',
'AS',
'City',
'13',
'10',
it gave me the whole string , now do not know how to proceed . Can someone help ??
Thanks