Opened 11 years ago

Closed 10 years ago

Last modified 6 years ago

#7939 closed enhancement (fixed)

Mapcss parser has no support for negated regular expressions

Reported by: AndrewBuck Owned by: team
Priority: normal Milestone: 13.12
Component: Core mappaint Version:
Keywords: mapcss Cc:


Currently the mapcss parser and language supports regular expressions via the =~ operator in the paint style files. Other similar languages, including the overpass API also offer a similar operator !~ which works the same way but returns true if the given tag does _not_ match the provided regular expression. This would be a useful addition to the language for specifying that a rule should apply to any object that has a tag whose value is not one of several provided options. For example:


can be used to match any highway which has a provided surface value, but whose surface value is not just simply paved or unpaved, i.e. it is something more specific like 'asphalt', or 'gravel'.

It is not clear to me whether a similar statement such as the one below should evaluate true or not if the object in question does not have a surface tag at all:


I added the extra [surface] qualifier in the first example for clarity. In this second example, although a road with just a highway tag, an no corresponding surface tag _does_ technically meet the definition of this rule I would suggest that that highway should _not_ match the rule unless it does actually have a surface tag, but it is not a member of the enumerated list, as this seems to be more likely what the user had in mind. I am not sure how overpass handles this edge case, but following their lead would probably be good for consistency.

Attachments (0)

Change History (6)

comment:1 Changed 10 years ago by Don-vip

Component: CoreCore mappaint
Resolution: fixed
Status: newclosed

In 6455/josm:

fix #7939 - MapCSS: add support for negated regular expressions

comment:2 in reply to:  1 Changed 10 years ago by AndrewBuck

Awesome, thanks for including this.

comment:3 Changed 10 years ago by Don-vip

Milestone: 13.12 (6502)

comment:4 Changed 10 years ago by simon04

In 6455/josm:

fix #7939 - MapCSS: add support for negated regular expressions

comment:5 Changed 10 years ago by Don-vip

@simon04: I just have modified your log message to match the good ticket, as I made the same mistake yesterday on another one :)
The syntax to change it is:

svn --username Don-vip propset -r 6455 --revprop svn:log "fix #7939 - MapCSS: add support for negated regular expressions"

That's why it trigerred the Trac update.

Last edited 10 years ago by Don-vip (previous) (diff)

comment:6 Changed 6 years ago by stoecker

Milestone: 13.12 (6502)13.12

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.