Commit 93603367 authored by Volker Krause's avatar Volker Krause
Browse files

More HTML whitespace robustness fixes

parent 5a22f385
......@@ -27,7 +27,7 @@ function parseHtml(doc) {
var res = JsonLd.newFlightReservation();
res.reservationNumber = pnr;
var f = row.recursiveContent.match(/(.*)\n(.*)\n\s*(\d{2}:\d{2})\s*\n\s*([A-Z0-9]{2}) *(\d{1,4})\s*\n(?:.*\n)*\s*(\d{2}:\d{2})\s*\n(.*)\n\s*(\d{2}:\d{2})/);
var f = row.recursiveContent.match(/(\d{2} \S{3} \d{2})[\n\s](.*)[\n\s]\s*(\d{2}:\d{2})[\n\s]\s*([A-Z0-9]{2}) *(\d{1,4})[\s\n]*(?:.*)*\s*(\d{2}:\d{2})\s*(.*)\s*(\d{2}:\d{2})/);
res.reservationFor.departureAirport.name = f[2];
res.reservationFor.arrivalAirport.name = f[7];
......
......@@ -18,7 +18,7 @@ function main(text) {
var res = JsonLd.newFlightReservation();
res.reservationNumber = bookingRef[1];
var leg = text.substr(pos + index).match(/ +(.+?) \(([A-Z]{3})\) - (.+?) \(([A-Z]{3})\) +[A-Z][a-z] (\d{2}.\d{2}.\d{4}) +(\d{2}:\d{2}) +[A-Z]{3} +(\d{2}:\d{2}) .*? ([A-Z0-9]{2}) (\d{3,4})/);
var leg = text.substr(pos + index).match(/(?:\n| +)(.+?) \(([A-Z]{3})\) - (.+?) \(([A-Z]{3})\)[\n\s]+[A-Z][a-z] (\d{2}.\d{2}.\d{4})[\s\n]+(\d{2}:\d{2}) +[A-Z]{3} +(\d{2}:\d{2}) +[A-Z]{3}[\n\s]+.*?[\n\s]+([A-Z0-9]{2}) (\d{3,4})/);
if (!leg)
break;
index += leg.index + leg[0].length;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment