Custom Checks ExamplesCustom check is a powerful tool of WME Validator to highlight very specific map issues, not covered with built-in validations.
To set up a custom check in Validator click
Settings->custom. There are two checks: green and blue. Each check has two fields:
template and
regular expression (RegExp).Hover your mouse over the template field to get a tooltip with
available variables. Validator
substitutes those variables with segment's data and then tries to
match that string over the RegExp. If the expanded template string matches the RegExp - Validator
highlights the segment.
Template VariablesMost of the variables are self-explanatory.
Note: empty address fields expand to empty streets, i.e. if you set "None" next to city name, then template "#${city}#" for this segment will be expanded to "##"
Road type: variable ${typeRank} expands to:
1 for Runways
2 for Railroads
...
14 for Major Highways
15 for Freeways
Road direction: variable ${direction} expands to:
0 for Unknown direction
1 for A->B
2 for B->A
3 for Two-way segments
Regular Expressions (RegExp)Regular expressions are patterns used to match character combinations in your expanded template. See the detailed description of regular expressions on MDN:
linkValidator provides the following two extensions for regular expressions:Debug RegExp. To debug your RegExp add letter D at the very beginning: D/^[a-z]/
Validator will print debug information to the JavaScript console (Ctrl+Shift+J), so you can see how template variables expand for the segments on the map.
Negate RegExp. Sometimes it's much easier to create a RegExp for a normal condition and then just negate the result. To do so, add an exclamation mark at the very beginning: !/ (St|Ave)$/
Easy ExamplesTo highlight streets with word NorthTemplate: ${street}
RegExp: /North/
To highlight invalid (null) elevationsTemplate: ${elevation}
RegExp: /null/
To highlight segments with no state assignedTemplate: ${state}
RexExp: /^$/
To highlight segments with a U-turnTemplate: ${Uturn}
RexExp: /1/
Medium ExamplesNew! To highlight Streets without speed limits:Template: ${type}:${speedLimit}
RegExp: /^1:0$/
To highlight Ramps with non-ground elevation:Template: ${typeRank}:${elevation}
RegExp: /12:[^0]/
To highlight Freeways which do not start with letter ATemplate: ${typeRank}:${street}
RegExp: /15:[^A]/
To highlight streets named "U-Turn" in LATemplate: ${state}:${street}
RegExp: /Louisiana:U-Turn/
To highlight dead-end U-turnsTemplate: ${deadEnd}:${Uturn}
RegExp: /1:1/
To highlight the opposite: missing dead-end U-turnsTemplate: ${deadEnd}:${Uturn}
RegExp: /1:0/
To highlight Freeways or Major Highways in format 'Axx', 'Ixx' etcTemplate: ${typeRank}:${street}
RegExp: /^(15|14):[a-z][0-9]/i
To search for segments shorter than 17m:Template: ${length}
RegExp: /^([0-9]|1[0-6])$/
To mark dead-ends without U-turn:Template: A${deadEndA}:${UturnA}:B${deadEndB}:${UturnB}
RegExp: /A1:0|B1:0/
To highlight more than 100m long unnamed drivable streets:Template: ${drivable}:${street}:${length}
RegExp: /1::...+/
Advanced ExamplesTo highlight street name which ends in Cntr, or Exd etc (any case variant)Template: ${street}
RegExp: / (Cntr|Exd|La|Plc|Rvr|Tnpk|Wy)$/i
To highlight segments that have an alt street specified but no cityTemplate: @@${altCity[0]}##${altStreet[0]}@@${altCity[1]}##${altStreet[1]}
RegExp: /@@##[^@]/
To highlight invalid abbreviations for Australian roadsTemplate: ${street}
RegExp: !/ (Ave|Blvd|Cl|Cres|Cct|Ct|Dr|Way|Line|Ln|Mtwy|Pde|Pl|Rd|St)$|^$/
To highlight lowercase street names for US (except S, N, W, E and to)Template: ${street}
RegExp: /^(?!(to) [^a-z])((S|N|W|E) )?[a-z]/
To highlight Freeways with no cardinal direction (NSEW)Template: ${type}:${street}
RegExp: !/^[^3]| [NSEW]$/
City name abbreviation 'snt' should be lowercase and at the very beginningTemplate: ${city}
RegExp: /(^|[ (])(?!^snt )[Ss][Nn][Tt]([ )]|$)/
To highlight segments if primary street name and one of the alt. names are the sameTemplate: #${street}#${altStreet[#]}#
RegExp: /(#.+)(?=#).*\1#/
See more examples in the "WME Validator localization for US" forum thread.