Home > Uncategorized > Parsing Skylights Route information

Parsing Skylights Route information

A company which develops airline websites, known as SkyLights, has a common format for javascript which they place on their webpages to populate two dynamic drop down lists for their routes.
 
This can be parsed out of the page, using this c# code
 

// var aVCE = new Array(‘TXL’,’HAM’,’HAJ’,’CGN’,’STR’, 0);

string[] strlines = Regex.Split(tbEntry.Text,@"n");

string strOutput = "";

foreach(string strLine in strlines)

{

string strFromIata = Regex.Match(strLine,@"a(w{3})s").Groups[1].Value;

MatchCollection mcIatas = Regex.Matches(strLine,@"’w{3}’");

foreach(Match mIata in mcIatas)

{

strOutput+="’" + strFromIata + "’," + mIata.Value + "rn";

}

}

tbEntry.Text = strOutput;

 
 
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: