[mkgmap-dev] subst function and literal dots in regular expressions
From Colin Smale colin.smale at xs4all.nl on Sun May 25 11:14:40 BST 2014
Hi, I am trying to normalise street names by removing any dots. So far I have been unable to get the subst function to do what I want. The problem seems to be getting the dot to be taken literally in the subst parameters. I have tried: a) set newname='${name|subst:. +=> }' b) set newname='${name|subst:. +=> }' c) set newname='${name|subst:[.] +=> }' All of the above seem to have no effect, i.e. newname ends up the same as name. I am thinking of doing it in two stages: firstly replacing ". " (dot followed by space) with a space, and then replacing any other dots with a space so "A.B. Street" ends up as "A B Street". I could also do it by replacing any dots by spaces and then compressing multiple spaces. But in both cases I need subst to match a literal dot. My current style rules look like this: highway=* & name ~ '.*[.].*' {set newname='${name|subst:. +=> }'} newname=* {echo "dots changed from ${name} to ${newname} (1)"; set name='${newname}'} highway=* & name ~ '.*[.].*' {set newname='${name|subst:[.]=> }'} newname=* {echo "dots changed from ${name} to ${newname} (2)"; set name='${newname}'} Can anyone help please? Colin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20140525/de325bc5/attachment.html>
- Previous message: [mkgmap-dev] splitter r386 - version number
- Next message: [mkgmap-dev] subst function and literal dots in regular expressions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list