Enhancement on SubstitutionFilter.java to handle regexp (filter "subst:")

I updated the SubstitutionFilter.java class in order to allow regexp on the subst filters by using the operator "~>" to state the first argument is a regexp. The default behavior is maintained if no operator (i.e. remove string) or "=>" is used This is convenient for mass corrections or in case we'll have some tweaks to apply on street address names to facilitate search, for example the style entry below (Carlos!) highway=* & name ~ '[Aa]venida [Dd]e [Ee]l .*' { add streettype:movend='${name|subst:Avenida De El |subst:Avenida De el |subst:Avenida de El |subst:Avenida de el |subst:avenida De El |subst:avenida De el |subst:avenida de El |subst:avenida de el }'} will become highway=* & name ~ '[Aa]venida [Dd]e [Ee]l .*' { add streettype:movedend='${name|subst:[Aa]venida [Dd]e [Ee]l ~>}'} Technically, the change is minimal, it is just checking the filter operator (=> or ~>) and using replaceAll() instead of replace() if "~>" is used. Attached the updated class - I really hope it will be included and be useful! Cheers, Enrico

Hi Enrico, thanks for your coding! It's a useful improvement. Henning

you deserve credits too... since you had the idea ;) Hey - I'm not sure how is the process to have this change (and also the other one on PartFilter) included in mkgmap, I suppose Steve|WanMil can/will commit this, right? Enrico On Thu, Aug 8, 2013 at 12:34 AM, Henning Scholland <osm@aighes.de> wrote:
Hi Enrico, thanks for your coding! It's a useful improvement.
Henning
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

On 09/08/13 09:26, Enrico Liboni wrote:
you deserve credits too... since you had the idea ;)
Hey - I'm not sure how is the process to have this change (and also the other one on PartFilter) included in mkgmap, I suppose Steve|WanMil can/will commit this, right?
That is now committed. Thanks! Your PartFilter patch also looks interesting. Any comments on that from anyone? If not I shall commit it soon. ..Steve

Great! let me know once the PartFiler is committed - if no one has any issue with it - I'll update the wiki then. Enrico On Friday, August 9, 2013, Steve Ratcliffe wrote:
On 09/08/13 09:26, Enrico Liboni wrote:
you deserve credits too... since you had the idea ;)
Hey - I'm not sure how is the process to have this change (and also the other one on PartFilter) included in mkgmap, I suppose Steve|WanMil can/will commit this, right?
That is now committed. Thanks!
Your PartFilter patch also looks interesting. Any comments on that from anyone? If not I shall commit it soon.
..Steve
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk <javascript:;> http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

I have just started to use the new SubstitutionFilter. It's saving a lot of code, checks for errors, etc. Thanks a lot Enrico.

Glad to hear this! Did you test also the PartFilter one? Enrico On Sun, Aug 11, 2013 at 8:38 PM, Carlos Dávila <cdavilam@orangecorreo.es>wrote:
I have just started to use the new SubstitutionFilter. It's saving a lot of code, checks for errors, etc. Thanks a lot Enrico. _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Enrico, thanks for your contributions! I am sure Steve will commit the PartFilter patch soon (I was not yet able to test it). It would be great if you could add some documentation to the mkgmap (official) documentation (not the wiki). Your parts are documented in the rules.txt file: http://www.mkgmap.org.uk/websvn/listing.php?repname=mkgmap&path=%2Ftrunk%2Fd... The format is asciidoc (http://powerman.name/doc/asciidoc). Thanks! WanMil
Glad to hear this! Did you test also the PartFilter one?
Enrico
On Sun, Aug 11, 2013 at 8:38 PM, Carlos Dávila <cdavilam@orangecorreo.es <mailto:cdavilam@orangecorreo.es>> wrote:
I have just started to use the new SubstitutionFilter. It's saving a lot of code, checks for errors, etc. Thanks a lot Enrico. _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk <mailto:mkgmap-dev@lists.mkgmap.org.uk> http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

WanMil, Steve, attached the updated rules-filters.txt (and the correspondent html version w/ asciidoc). Thanks for committing this change as well! Enrico On Tue, Aug 13, 2013 at 12:24 PM, WanMil <wmgcnfg@web.de> wrote:
Hi Enrico,
thanks for your contributions! I am sure Steve will commit the PartFilter patch soon (I was not yet able to test it).
It would be great if you could add some documentation to the mkgmap (official) documentation (not the wiki). Your parts are documented in the rules.txt file:
http://www.mkgmap.org.uk/websvn/listing.php?repname=mkgmap&path=%2Ftrunk%2Fd...
The format is asciidoc (http://powerman.name/doc/asciidoc).
Thanks! WanMil
Glad to hear this! Did you test also the PartFilter one?
Enrico
On Sun, Aug 11, 2013 at 8:38 PM, Carlos Dávila <cdavilam@orangecorreo.es <mailto:cdavilam@orangecorreo.es>> wrote:
I have just started to use the new SubstitutionFilter. It's saving a lot of code, checks for errors, etc. Thanks a lot Enrico. _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk <mailto: mkgmap-dev@lists.mkgmap.org.uk> http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

On 13/08/13 22:46, Enrico Liboni wrote:
WanMil, Steve, attached the updated rules-filters.txt (and the correspondent html version w/ asciidoc).
Thanks very much for updating the documentation. This is now committed, sorry about the delay. Best wishes ..Steve

El 13/08/13 12:12, Enrico Liboni escribió:
Glad to hear this! Did you test also the PartFilter one? Not yet. I have to look a little more on it to see its potential use.
Enrico
On Sun, Aug 11, 2013 at 8:38 PM, Carlos Dávila <cdavilam@orangecorreo.es <mailto:cdavilam@orangecorreo.es>> wrote:
I have just started to use the new SubstitutionFilter. It's saving a lot of code, checks for errors, etc. Thanks a lot Enrico.
participants (5)
-
Carlos Dávila
-
Enrico Liboni
-
Henning Scholland
-
Steve Ratcliffe
-
WanMil