logo separator

[mkgmap-dev] regular expressions in tag tests

From Kay F. Jahnke _kfj at yahoo.com on Tue Jun 5 16:12:44 BST 2012

Am 05.06.2012 16:25, schrieb Steve Ratcliffe:

> If you are not very familiar with regular expressions in any language
> then if you reply with a few examples of what you want to match I can
> probably help out.

Thank you for your help and prompt reply!

Quite familiar, actually - now I managed to work it out. I think mkgmap 
strips trailing and heading ws from the field content. I stumbled over 
some of my data having more than two postcomma zeroes (only saw that 
later, I have a good 1000 files). After some fiddling about I concluded 
that the whole field content has to be consumed by the RE for a match to 
occur. So eventually I ended up with this segment in my lines file which 
now seems to do the job:

# only major lines receive a name. Note the conversion to feet.

ENT_LIN=2.08.01 & ( QUOTA ~ '.*[05]00\.0+' )
  { name '${QUOTA|conv:m=>ft}' } [0x22 level 2]

ENT_LIN=2.08.01 & ( QUOTA ~ '.*[05]0\.0+' )
  { name '${QUOTA|conv:m=>ft}' } [0x21 level 1]

# any remaining contours will be rendered as minor, without name

ENT_LIN=2.08.01 [0x20 level 0]

the escaped points work as expected. I noticed the example in the wiki 
was using '\d', so apparently there's shortcuts available (I assume \d 
is digits - any others?)

One more thing: I tried to match a RE at the top level and failed. Is 
there a workaround to achieve the same thing? My classification is 
mainly by codes like the ENT_LIN above, and they come in sections. So it 
would be nice if I could match '2\.08\.??' at the top level.

Kay



More information about the mkgmap-dev mailing list