Hi Nathan,
I'd like to escape _ or %.
I'd like to do it because I've been requested to fix the OGC Element
PropertyIsLike.
This element can specify it's own escape char, single char and wild char
For exemple the * can be defined as the wild char so the % has to be
escaped to be used as an expression.
I'm preparing a PR with updated help.
René-Luc
Le 24/09/2016 à 05:27, Nathan Woodrow a écrit :
Hey,
When would you normally need an escape char for LIKE?
- Nathan
On Fri, Sep 23, 2016 at 6:33 PM, René-Luc Dhont <[email protected]
<mailto:[email protected]>> wrote:
Hi Devs,
I'd like to know if an escape character is defined for the LIKE
operator in QGIS Expression.
If I take a look at the code src/core/qgsexpression.cpp:4343 no
escape char is used
```
if ( mOp == boLike || mOp == boILike || mOp == boNotLike
|| mOp == boNotILike ) // change from LIKE syntax to regexp
{
QString esc_regexp = QRegExp::escape( regexp );
// XXX escape % and _ ???
esc_regexp.replace( '%', ".*" );
esc_regexp.replace( '_', '.' );
matches = QRegExp( esc_regexp, mOp == boLike || mOp ==
boNotLike ? Qt::CaseSensitive : Qt::CaseInsensitive ).exactMatch(
str );
}
```
Do you think we have to add one ?
Regards,
René-Luc
_______________________________________________
Qgis-developer mailing list
[email protected] <mailto:[email protected]>
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
<http://lists.osgeo.org/mailman/listinfo/qgis-developer>
Unsubscribe:
http://lists.osgeo.org/mailman/listinfo/qgis-developer
<http://lists.osgeo.org/mailman/listinfo/qgis-developer>
_______________________________________________
Qgis-developer mailing list
[email protected]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer