<div dir="ltr">Hey,<div><br></div><div>When would you normally need an escape char for LIKE?</div><div><br></div><div>- Nathan </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 23, 2016 at 6:33 PM, René-Luc Dhont <span dir="ltr"><<a href="mailto:rldhont@gmail.com" target="_blank">rldhont@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Devs,<br>
<br>
I'd like to know if an escape character is defined for the LIKE operator in QGIS Expression.<br>
<br>
If I take a look at the code src/core/qgsexpression.cpp:434<wbr>3 no escape char is used<br>
```<br>
        if ( mOp == boLike || mOp == boILike || mOp == boNotLike || mOp == boNotILike ) // change from LIKE syntax to regexp<br>
        {<br>
          QString esc_regexp = QRegExp::escape( regexp );<br>
          // XXX escape % and _  ???<br>
          esc_regexp.replace( '%', ".*" );<br>
          esc_regexp.replace( '_', '.' );<br>
          matches = QRegExp( esc_regexp, mOp == boLike || mOp == boNotLike ? Qt::CaseSensitive : Qt::CaseInsensitive ).exactMatch( str );<br>
        }<br>
```<br>
Do you think we have to add one ?<br>
<br>
Regards,<br>
René-Luc<br>
______________________________<wbr>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-developer</a></blockquote></div><br></div>