Home > Uncategorized > Parsing WindJet routes

Parsing WindJet routes

Probobly a particularly niche field, but I just developed some code to parse airline routes from the website VolaWindJet.
 

private string GetWindJetRoutes(string HTML)

{

string outRoutes = "";

// Step 1. Delete between FL_Departure> and /SELECT

string strOutboundRoutes = DeleteBetween(HTML,"FL_Departure>","/SELECT");

MatchCollection mcDepIata = Regex.Matches(strOutboundRoutes,"value=(?<FromIata>[A-Z]{3})");

// Step 2. extract ToIata Array

string strRegex = @"arrayVoli[(?<IDFrom>d+)][(?<IDTo>d+)]=new.Option(‘w.*'(?<ToIata>w{3})";

MatchCollection mcDestIata = Regex.Matches(HTML,strRegex);

for(int iMatch=0;iMatch<mcDestIata.Count;iMatch++)

{

int intIDFrom = Convert.ToInt32(mcDestIata[iMatch].Groups["IDFrom"].Value);

string strFromIata = mcDepIata[intIDFrom-1].Groups["FromIata"].Value;

string strToIata = mcDestIata[iMatch].Groups["ToIata"].Value;

outRoutes += "’" + strFromIata + "’,’" + strToIata + "’rn";

}

return outRoutes;

}

 

Might be of interest to someone out there…. (or if not, my own personal reference)

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: