LeighGr wrote:I'm busy creating a WMEV localization pack for South Africa, but am bashing my head against a wall with some weird errors. The following code works fine for mH segments named R100 to R512, and then again from R516 onwards, but R513, R514 and R515 all get flagged as incorrect. WHY?????
- Code: Select all
// Custom Check - Minor Highway Name Format
"137.enabled": true,
"137.params": {
"titleEN": "Incorrect name format on Minor Highway",
"problemEN": "All Minor Highways name format should be (R###) numbered > 100 ",
"solutionEN": "Change name to ... (R###)",
"template": "${typeRank}:${street}:${direction}",
"regexp": "/(13):(?!R[0-9]{3} [NESW]:(1|2) ?|(R[0-9]{3}:(3))$)/"
},
"137.solutionLink": "W:South_Africa#Road_Network",
513 is being flagged because you are not anchoring and it is matching the 13:R513:3 from the string produced by your template.
you could try this and see if works better for you.
- Code: Select all
"regexp": "/^13:(?!(R[1-9]\\d{2}( [NESW]:[12] ?|:3))$)/"
I also noticed you are allowing an optional space in the string after the direction on one-way segments, not sure why you would want that, but I did include it. I moved the anchors and groups around a bit to accomplish what I think you want.
"/(13):(?!R[0-9]{3} [NESW]:(1|2) ?|(R[0-9]{3}:(3))$)/"
Edit: your code also allowed numbers <100 such as R099, as long as they were 3 digits. I updated it to only allow >100.
Edit2: shortened code, should still work the same