Opened 5 months ago

Last modified 5 months ago

#22466 new enhancement

Mapcss: allow [/REGEX/=string] selectors

Reported by: Famlam Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: template_report regex mapcss Cc:


What steps will reproduce the problem?

  1. Add a rule way[/sidewalk:(left|right|both)/=yes] in mapcss validator rules
  2. Get the error below

What is the expected result?

Allow comparing regex keys with string values (i.e., support =, ^=, etc when they key is a regex)

What happens instead?

The error java.lang.IllegalArgumentException: Op must be REGEX or NREGEX

To work around it, you need a regex comparison like:
(e.g. [/REGEX/=~/^string-as-regex$/] rather than [/REGEX/=string])

Please provide any additional information below. Attach a screenshot if possible.

Build-Date:2022-10-07 11:33:30

Identification: JOSM/1.5 (18570 nl) Windows 10 64-Bit
OS Build number: Windows 10 Home 2009 (19044)
Memory Usage: 252 MB / 2012 MB (129 MB allocated, but free)
Java version: 17.0.4+8-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel:
Screen: \Display0 1920×1080 (scaling 1.10×1.10)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: Cp1252
System property sun.jnu.encoding: Cp1252
Locale info: nl_NL
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [, --add-modules=java.scripting,java.sql,javafx.controls,,javafx.swing,javafx.web, --add-exports=java.base/, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED, --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED, --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,\AppData\Local\JOSM\JOSM.exe]
Dataset consistency test: No problems found

+ OpeningHoursEditor (35924)
+ SimplifyArea (35978)
+ imagery_offset_db (35978)
+ pbf (35978)
+ pt_assistant (1ff2e15)
+ reverter (36011)
+ tageditor (36011)
+ turnlanes-tagging (v0.0.5)
+ undelete (36011)
+ utilsplugin2 (36011)

Tagging presets:

Map paint styles:
+ %UserProfile%\Documents\tijdelijke bestanden\josm-eigen.mappaint.mapcss

Validator rules:
+ %UserProfile%\Documents\tijdelijke bestanden\josm-eigen.validator.mapcss

Last errors/warnings:
- 00000.858 W: extended font config - overriding 'filename.Myanmar_Text=mmrtext.ttf' with 'MMRTEXT.TTF'
- 00000.861 W: extended font config - overriding 'filename.Mongolian_Baiti=monbaiti.ttf' with 'MONBAITI.TTF'
- 00003.378 E: Windows-ROOT not found. Oorzaak: Windows-ROOT KeyStore not available
- 00018.206 E: Lokaliseren van afbeelding 'bus.png' mislukt
- 00040.107 E: Handled by bug report queue: java.lang.IllegalArgumentException: Op must be REGEX or NREGEX

No data collected.

Warning issued by: BugReportExceptionHandler#handleException

Thread: File Watcher (28)
java.lang.IllegalArgumentException: Op must be REGEX or NREGEX
	at org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory$KeyValueRegexpCondition.<init>(
	at org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory$RegexpKeyValueRegexpCondition.<init>(
	at org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.createRegexpKeyRegexpValueCondition(
	at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.simple_key_value_condition(
	at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.condition(
	at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.selector(
	at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.child_selector(
	at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.selectors(
	at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.rule(
	at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.sheet(
	at java.base/ Source)

Attachments (0)

Change History (1)

comment:1 Changed 5 months ago by skyper

Component: Core validatorCore

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to Famlam
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment

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

Note: See TracTickets for help on using tickets.