[mapserver-users] Limits on CLASS EXPRESSIONS for regular expressions

Stephen Woodbridge woodbri at swoodbridge.com
Wed Sep 21 21:02:56 EDT 2011


Thanks Thomas,

That would explain it. I thought that we had converted to pcre in 
mapserver, but I must have been mistaken. I solved it by changing the 
expressions to /word1|word2|.../ style of list.

Perl has a very cool module Regexp::List that lets you take a list of 
words and creates an optimized regexp that will recognize any word in 
the list and reject anything not in the list. I use it for other stuff 
and thought I had used it with mapserver but that was probably not the 
case, now that you point this out.

Back to the salt mines ...

-Steve

On 9/21/2011 8:46 PM, thomas bonfort wrote:
> If I'm not mistaken, mapserver uses regex, which has a smaller
> featureset than perl's regular expressions. Using pcre instead of
> regex inside mapserver might solve your problem.
>
> --
> thomas
>
> On Wed, Sep 21, 2011 at 06:29, Stephen Woodbridge
> <woodbri at swoodbridge.com>  wrote:
>> Does anyone know if/what restrictions we have on regular expressions within
>> mapserver. I have a perl regular expression that matches 44 of 120 counties
>> in Kentucky:
>>
>> EXPRESSION
>> /(?-xism:(?i:(?=[abcfghjlmnorstw])(?:b(?:o(?:y(?:d|le)|urbon)|u(?:llitt|tler)|(?:arr|rack)en)|c(?:a(?:rter|sey)|(?:hristia|rittende)n|lark)|f(?:ayette|leming|ulton)|h(?:a(?:ncock|rt)|enderson)|l(?:e(?:tcher|wis)|(?:incol|oga|yo)n)|m(?:a(?:di)?son|e(?:rcer|tcalfe)|o(?:ntgomery|rgan)|ccracken|uhlenberg)|s(?:helby|impson|pencer)|t(?:aylor|odd)|w(?:ayne|oodford)|adair|grant|johnson|nicholas|oldham|russell)))/
>>
>> This has been optimized and uses some embedded modifiers. This works fine in
>> Perl but does not match anything in mapserver.
>>
>> Any thoughts on how to modify this to work with mapserver. While this looks
>> very convoluted, it is generated from a list of words and is high efficient
>> when matching.
>>
>> Thoughts?
>>
>> -Steve W
>>
>> PS: Using 5.6.x at the moment.
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>



More information about the mapserver-users mailing list