Opened 6 years ago

Last modified 6 years ago

#18166 closed enhancement

[RFC] New tag proposal: "filter" — at Initial Version

Reported by: francians Owned by: team
Priority: normal Milestone:
Component: Core validator Version:
Keywords: mapcss filter italian housenumber validator Cc:

Description

Hello,

I built my regex this way:

*[addr:housenumber][addr:housenumber !~ /^[0-9]+(([a-z]*)|(\/[0-9]+))(\b rosso\b)?$/][inside("IT")] {
	throwWarning: tr("Numero Civico");
	group: "MapThisWay";
}

to check all possible italian values:

  • 1 <---- will match
  • 1bis <---- will match
  • 1/1 <---- will match
  • 1a rosso <---- will match
  • 1;3 <---- will not match
  • 1,3 <---- will not match

but I don't know a way to check each value when it's a csv (semicolon or comma separated).
I could do: if value contains comma, split by comma else split by semicolon... right?
But with the list I cannot check if every value matches my rule...

What do you think about a "filter" method that given regex + list could return all matching elements?
So to close the circle, I can count original list, count filtered list and if the number is not the same give the error.

Please let me know what you think and if it could be helpful a patch

Many Thanks
Francesco

Change History (0)

Note: See TracTickets for help on using tickets.