<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Your pattern allows for upper case letters and you&#8217;re passing lower case. Hence the &nbsp;error.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Steve<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Li Quansheng [mailto:quansheng.cs@gmail.com]
<br>
<b>Sent:</b> Saturday, April 21, 2012 10:38 AM<br>
<b>To:</b> mapserver-users@lists.osgeo.org; Lime, Steve D (DNR)<br>
<b>Subject:</b> mapserver 5.6 CGI output GeoJSON format 2<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">hi guys,Steve<br>
A few day ago I post an item &quot; mapserver 5.6 CGI output GeoJSON format &quot; <a href="http://lists.osgeo.org/pipermail/mapserver-users/2012-April/072028.html">
here</a> in which I asked a question about&nbsp; mapserver CGI output GeoJSON,finally with Steve's help I got it!<o:p></o:p></p>
<pre><o:p>&nbsp;</o:p></pre>
<pre>URL1:<a href="http://192.168.207.100/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map&amp;layer=tielu&amp;mode=nquery&amp;qformat=geojson">http://192.168.207.100/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map&amp;layer=tielu&amp;mode=nquery&amp;qformat=geojson</a>. <br><br><o:p></o:p></pre>
<pre>But&nbsp; now I want to add where-clause to prefilter,or I want set filter with CGI. The 'tielu' layer stored in postgis including these fields: gid,type,name,comment,the_geom,<br>then I execute <br>URL2:<a href="http://192.168.207.100/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map&amp;layer=tielu&amp;mode=nquery&amp;qlayer=tielu&amp;qitem=name&amp;qstring=namexx&amp;qformat=geojson">http://192.168.207.100/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map&amp;layer=tielu&amp;mode=nquery&amp;qlayer=tielu&amp;qitem=name&amp;qstring=namexx&amp;qformat=geojson</a><br><br><o:p></o:p></pre>
<pre>but the output is as same as the URL1's output, in fact the qstring, qitem don't take affect.<br>I searched&nbsp; and visited <br><a href="http://www.osgeo.org/pipermail/mapserver-users/2003-April/042003.html">http://www.osgeo.org/pipermail/mapserver-users/2003-April/042003.html</a><br><br><o:p></o:p></pre>
<pre>and <br><a href="http://lists.osgeo.org/pipermail/mapserver-users/2009-August/062581.html">http://lists.osgeo.org/pipermail/mapserver-users/2009-August/062581.html</a>,&nbsp; which are all Steve's&nbsp; ansewer posts. <br>so I modified tielu layer in the mapfile as Steve's suggestion,<br><br><o:p></o:p></pre>
<pre>...<br>&nbsp;&nbsp;&nbsp; METADATA<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;'ows_title'&nbsp;&nbsp;&nbsp; 'tielu'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &quot;wfs_title&quot;&nbsp;&nbsp;&nbsp; &quot;tielu&quot; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;....<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;qstring_validation_pattern&quot; '^[A-Z]{2,8}$' <br>&nbsp;&nbsp;&nbsp;&nbsp;END<br><br><o:p></o:p></pre>
<pre>...<br>&nbsp;then I execute <br><a href="http://192.168.207.100/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map&amp;layer=tielu&amp;mode=itemnquery&amp;qlayer=tielu&amp;qitem=name&amp;qstring=namexx&amp;qformat=geojson">http://192.168.207.100/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/xj1/xj1.map&amp;layer=tielu&amp;mode=itemnquery&amp;qlayer=tielu&amp;qitem=name&amp;qstring=namexx&amp;qformat=geojson</a>,<br><br><o:p></o:p></pre>
<pre>and returns the error,<br>mapserv(): Web application error. Parameter 'qstring' value fails to validate.<o:p></o:p></pre>
<pre>msValidateParameter(): Regular expression error. Parameter pattern validation failed.<o:p></o:p></pre>
<pre>msEvalRegex(): Regular expression error. String failed expression test.<o:p></o:p></pre>
<pre style="margin-bottom:12.0pt">I have to search and search, but couldn't work out. any suggestion, thans very much.<br><br><o:p></o:p></pre>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>