mkgmap style: Check, if name _contains_ a word

I am designing a style-file that produces special symbols for a few special supermarkets on my garmin. In germany, buildings of the same chain of supermarkets often are named differently, e. g. “XYZ”, “XYZ-Markt”, “XYZ-Supermarkt”, “XYZ Markt”, …

Is there an expression for the points-File to recognize all of them, like

shop=supermarket & name contains XYZ [0x2e1d level 3] ?

AFAIK this is not possible with mkgmap.
You could just have a rule with several different options for the name in. eg
shop=supermarket & (name=XYZ | name=XYZ-Markt | name=XYZ-Supermarkt) [0x2e1d level 3]
Then if any of the names match, that symbol will be set.

Or you could preprocess your OSM data using Osmosis with the TagTransform plugin.
It lets you use regular expressions to match tags, then you could set them all to a standard name.

Thank you for this information.

How do I check for names that consists of two words with a space in between?
The line

       shop=supermarket & name=Penny Markt [0x2e1b level 3]

leads to an mkgmap-Error “Could not open style null”. The line

       shop=supermarket & name="Penny Markt" [0x2e1b level 3]

was accepted by mkgmap, but this supermarket did not show up in my Garmin.

The style files can parse regular expressions, though I’ve never got round to trying it.

Thats brilliant! Here is, how it works:

shop=supermarket & name ~ ‘Penny.*’ [0x2e1b level 3]

It finds everything starting with Penny as far as I could recognize.

Cool, I have been looking for this too!
With this I can now select all bicycle routes starting with “LF” like ref=LF 15
type=route & route=bicycle & network=ncn & ref ~ ‘LF.*’

In Belgium the ref is numbered with a preceeding “LF” but in the Netherlands not, its just ref=15
On my cycle map I put standard LF in the label in front of the number, so the Dutch routes show up nicely like “LF15” but the Belgium routes show up like “LF LF 15”

So, I want an expression to select all routes with type=route & route=bicycle & network=ncn & ref “not starting with LF”
How can I do that?

I’m no regex expert, but assuming the mkgmap regex parsing works normally, the ^ can be used to negate a character class. Maybe something like

type=route & route=bicycle & network=ncn & ref ~ ^'[^LF].*'

which should mean ref cannot start with LF

It may well be worth posting a query to the mkgmap-dev list as I know that Marko has used regex style rules in the past.

(without the first ^)

did the trick, thanks!

Yeah, I think the first caret should have been inside the quotes:

 ref ~ '^[^LF].*' 

might work.

The initial caret stipulates that the match has to happen at the very start of the ref, rather than mid-way through.