[mapserver-dev] Bug(s) with REGEX on 5.6.8?

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Thu Mar 1 11:54:54 EST 2012


I don't believe ~* is a valid operator in 5.6.8. Use of square brackets is a known limitation and was fixed in 6.0 I believe.

Steve

________________________________________
From: mapserver-dev-bounces at lists.osgeo.org [mapserver-dev-bounces at lists.osgeo.org] on behalf of Stephen Woodbridge [woodbri at swoodbridge.com]
Sent: Thursday, March 01, 2012 10:30 AM
To: mapserver-dev
Subject: [mapserver-dev] Bug(s) with REGEX on 5.6.8?

Hi All,

This is beginning to look like a bug in expression handling on 5.6.8
and/or the documentation.

/u/www/cgi-bin/mapserv -v
MapServer version 5.6.8 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV
SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT
SUPPORTS=WFS_SERVER SUPPORTS=RGBA_PNG INPUT=EPPL7 INPUT=POSTGIS
INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

I have tried all the following EXPRESSIONs and they all report an error
int logfile.

EXPRESSION ("[RTTYP]" ~* /U|S|C/)
EXPRESSION ("[RTTYP]" ~* /(U|S|C)/)
EXPRESSION ("[RTTYP]" ~* /^(U|S|C)/)
EXPRESSION ("[RTTYP]" ~* /^[USC]/)

EXPRESSION ("[RTTYP]" ~* "/U|S|C/")
EXPRESSION ("[RTTYP]" ~* "/(U|S|C)/")
EXPRESSION ("[RTTYP]" ~* "/^(U|S|C)/")
EXPRESSION ("[RTTYP]" ~* "/^[USC]/")

EXPRESSION ("[RTTYP]" ~* "U|S|C")
EXPRESSION ("[RTTYP]" ~* "(U|S|C)")
EXPRESSION ("[RTTYP]" ~* "^(U|S|C)")
EXPRESSION ("[RTTYP]" ~* "^[USC]")

So for example:
EXPRESSION ("[RTTYP]" ~* /U|S|C/)
generates:
msEvalExpression: Expression parser error. Failed to parse expression:
"M" ~* /U|S|C/

EXPRESSION ("[RTTYP]" ~ "/U|S|C/")
msEvalExpression: Expression parser error. Failed to parse expression:
"M" ~ "/U|S|C/"

EXPRESSION ("[RTTYP]" ~ "U|S|C")
msEvalExpression: Expression parser error. Failed to parse expression:
"M" ~ "U|S|C"

And /[USC]/ and "/[USC]/" and variants reports:
Failed to draw layer named 'roads'.; msDBFGetItemIndex(): DBASE file
error. Item 'USC' not found.

The documentation at:
http://mapserver.org/mapfile/expressions.html#regular-expression-comparison

is very ambiguous with some examples of regex like 'by$' without the
slashes and others with slashes.

So I will write a bug on the doc, but I would like to include the
correct syntax and since I can not find anything that works :(

I'm probably missing something stupid, but if not this seems like a
serious issue.

-Steve W
_______________________________________________
mapserver-dev mailing list
mapserver-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-dev




More information about the mapserver-dev mailing list