Add regex matching rules for large groups of uniform line icons #35
Labels
needs-discussion
This issue / pull request needs to be discussed.
specification
Changes at specification
I think it would be a big time-saver to allow regex rules for matching a lot of lines to the same design icon.
For example, i've managed to break almost 300 Bus and Ferry lines that share a number space down into 6 rules:
echtnurich/line-colors - [proposal-regex] /line-colors.csv
I've used regex101.com to validate these.
It also helps with understanding the use of named matching groups to extract the line (or operator) from the hafasLineId.
I'm not sure what syntax would be optimal to actually implement, so for now I'm going to leave it at the proposal for further discussion.
Examples
Primary Metrobuses
^5\-hvv(?'operator'hha|vhh)\-(?'line'\d)$
Secondary Metrobusses
^5\-hvv(?'operator'hha|vhh)\-(?'line'[1-2]\d)$
Citybuses
^5\-hvv(?'operator'hha|vhh)\-(?'line'[0-5,7-9]\d\d)$
Nightbuses
^5\-hvv(?'operator'hha|vhh)\-(?'line'[6]\d\d)$
Expressbuses
^5\-hvv(?'operator'hha|vhh)\-x(?'line'\d{1,2})$
Ferries
^6\-hvv(?'operator'had)\-(?'line'[6-7]\d)$
The text was updated successfully, but these errors were encountered: