[Mapcss] Regexp as attribute selection

Chris Browet cbro at semperpax.com
Mon Jul 19 10:12:37 BST 2010


On Mon, Jul 19, 2010 at 09:44, Richard Fairhurst <richard at systemed.net>wrote:

> 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).
>>
>> Shouldn't it be wise to remove this from the spec and replace it by
>> simpler cardinals ('*', '?' and maybe others)?
>>
>
> I'd strongly like to stick with regexes.
>
> They are built into many languages and available as a library for others.
> If we require people to build their own pattern matchers, that will make it
> harder for people to implement MapCSS parsers.
>
> PCRE is a widely-used regex standard which we could recommend. Any
> differences are usually reasonably trivial and esoteric (for example,
> http://www.mail-archive.com/develop@xcruciate.co.uk/msg00031.html only
> lists two edge cases in which PCRE differs from JavaScript/ECMAScript).
>
> Wikipedia suggests this will give us widespread compatibility: "Java,
> JavaScript, PCRE, Python, Ruby, Microsoft's .NET Framework, and the W3C's
> XML Schema all use regular expression syntax similar to Perl's. Some
> languages and tools such as Boost and PHP support multiple regular
> expression flavors".
>

As I said, I've no real issue with that (just hoping Qt has the adequate
level of regexp support).

It should just be mentioned somewhere that PCRE (now I know) expressions
must be used and define or point to the minimal level of spec support
required. Qt, for instance, has regexp support, but I don't know how
compatible it is with PCRE.

- Chris -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/mapcss/attachments/20100719/3a620bb0/attachment.html>


More information about the Mapcss mailing list