mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 16:29:51 +00:00
fixed regexp match running long
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@65 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
c60df467e7
commit
35e8d341ee
2 changed files with 50 additions and 4 deletions
|
@ -204,8 +204,8 @@ public class SbbProvider implements NetworkProvider
|
|||
+ "<td .*?class=\"date.*?>\n?(?:.., (\\d{2}\\.\\d{2}\\.\\d{2})\n?)?</td>.*?" // departureDate
|
||||
+ "<td .*?class=\"time.*?>(?:(\\d{2}:\\d{2})| )</td>.*?" // departureTime
|
||||
+ "<td .*?class=\"platform.*?>\n?\\s*(.+?)?\\s*\n?</td>.*?" // departurePosition
|
||||
+ "<img src=\"/img/2/products/(\\w+?)_pic.gif\" .*? alt=\"(.*?)\".*?>.*?" // line
|
||||
+ "<td .*?class=\"remarks.*?>(?:\n?(\\d+) Min\\..*?)?</td>.*?" // min
|
||||
+ "<img src=\"/img/2/products/(\\w+?)_pic.gif\" .*? alt=\"(.*?)\" .*?><br />.*?" // line
|
||||
+ "(?:<td .*?class=\"remarks.*?>\n?(\\d+) Min\\..*?</td>.*?)?" // min
|
||||
+ "<a href=\"http://fahrplan\\.sbb\\.ch/bin/bhftafel\\.exe/dn.*?input=(\\d+)&.*?\" .*?>" // arrivalId,
|
||||
+ "(.*?)</a>.*?" // arrival
|
||||
+ "<td .*?class=\"date.*?>\n?(?:.., (\\d{2}\\.\\d{2}\\.\\d{2})\n?)?</td>.*?" // arrivalDate
|
||||
|
@ -433,6 +433,7 @@ public class SbbProvider implements NetworkProvider
|
|||
}
|
||||
|
||||
private static final Pattern P_NORMALIZE_LINE = Pattern.compile("([A-Za-zÄÖÜäöüß]+)[\\s-]*(.*)");
|
||||
private static final Pattern P_NORMALIZE_LINE_SBAHN = Pattern.compile("s\\d*");
|
||||
|
||||
private static String normalizeLine(final String type, final String line)
|
||||
{
|
||||
|
@ -457,13 +458,17 @@ public class SbbProvider implements NetworkProvider
|
|||
return "I" + strippedLine;
|
||||
if (type.equals("tha")) // Thalys
|
||||
return "I" + strippedLine;
|
||||
if (type.equals("rj")) // RailJet, Österreichische Bundesbahnen
|
||||
return "I" + strippedLine;
|
||||
if (type.equals("r"))
|
||||
return "R" + strippedLine;
|
||||
if (type.equals("re"))
|
||||
return "R" + strippedLine;
|
||||
if (type.equals("ir"))
|
||||
return "R" + strippedLine;
|
||||
if (type.matches("s\\d*"))
|
||||
if (type.equals("d"))
|
||||
return "R" + strippedLine;
|
||||
if (P_NORMALIZE_LINE_SBAHN.matcher(type).matches())
|
||||
return "S" + strippedLine;
|
||||
if (type.equals("tra"))
|
||||
return "T" + strippedLine;
|
||||
|
@ -529,7 +534,7 @@ public class SbbProvider implements NetworkProvider
|
|||
return "R" + number;
|
||||
if (type.equals("IR")) // InterRegio
|
||||
return "RIR" + number;
|
||||
if (type.equals("D")) // D-Zug?
|
||||
if (type.equals("D"))
|
||||
return "RD" + number;
|
||||
if (type.equals("E"))
|
||||
return "RE" + number;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue