maybe like this:
dt = Current Data Table();
ColNames = dt << Get COlumn Names();
colstrings = char(colnames);
match = regex(colstrings, "[{,]\s*([^{,}]*ID[^{,}]*)[,}]", "\1");
show(Match);
Match = "Flight ID";
which depends on the column names not using commas or curly braces. The char function turns the list of names into a string:
{Airline, Carrier Code, Flight Number, Tail Number, Flight ID, Event, Airport, Time,
Original Time, Longitude, Latitude}
becomes
"{Airline, Carrier Code, Flight Number, Tail Number, Flight ID, Event, Airport, Time, Original Time, Longitude, Latitude}"
I chose regex for this because...well it won't be beautiful either way. Breaking down the regex pattern:
"[{,] either an open curly brace or a comma
\s* optional white space
([^{,}]*ID[^{,}]*) the outer parens are the \1 match (more below)
[,}]" either a comma or a close curly brace
breaking down the \1 part:
[^{,}]* zero or more characters that are not curly braces or commas
ID the word you are hunting in a column name
[^{,}]* zero or more characters that are not curly braces or commas
the third arg to regex, "\1", means use the first open paren to identify the replacement text.
Craige