[Mapcss] Regexp as attribute selection

Andrew O. Shadoura bugzilla at tut.by
Sun Jul 18 22:37:34 BST 2010


Hello.

On Sunday 18 July 2010 23:02:06 Chris Browet wrote:
> In the doc, it is described that regexp attribute selection is allowed
> ("way[highway=~/primary/]    /* regex */").

> While it is inherently nice, the problem is that there is almost as many
> regexp syntaxes as there are implementations.
> At least, the syntax used should be defined (is the example perl?) but I
> doubt it will be practical to implement a specific syntax for MapCSS in
> every programming language (not even speaking of those not having builtin
> support).

Yes, I agree that simple glob-alike matching should be enough for most needs, 
and it would be much faster than using regexps.

> Shouldn't it be wise to remove this from the spec and replace it by simpler
> cardinals ('*', '?' and maybe others)?

How about these rules:

For the two strings to match, their contents must be identical except that the 
following special sequences may appear in pattern:

  *     Matches any sequence of characters in string, including a null string.

  ?     Matches any single character in string.

  [chars]   Matches any character in the set given by chars.  If a sequence of 
the form x-y appears in  chars,  then  any character  between  x  and y, 
inclusive, will match.

  \x        Matches the single character x.  This provides a way of avoiding 
the special interpretation of the characters  *?[]\ in pattern.


-- 
WBR, Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.openstreetmap.org/pipermail/mapcss/attachments/20100719/da003aa4/attachment.pgp>


More information about the Mapcss mailing list