<div dir="ltr">Hey Tom,<br><br>Don't use regex.  You are in for a world of pain if you go that way, and not the kind of pain you feel good about after.  I will have a better method for you soon.<br><div><br></div><div>- Nathan</div></div><br><div class="gmail_quote">On Thu, 16 Apr 2015 at 20:20 Tom Chadwin <<a href="mailto:tom.chadwin@nnpa.org.uk">tom.chadwin@nnpa.org.uk</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm implementing rule-based rendering in qgis2leaf. I know I can get the<br>
filterExpressions with:<br>
<br>
qgis.utils.iface.mapCanvas().layers().rendererV2().rootRule().children().filterExpression()<br>
<br>
However, filterExpressions are in "SQL-like" syntax. I need to transform<br>
these into JavaScript:<br>
<br>
QGIS:  "name"  LIKE '%a%'<br>
JS: <a href="http://feature.properties.name" target="_blank">feature.properties.name</a>.indexOf('a') != -1<br>
<br>
At the moment, I am facing a whole load of messy regexps to cover all<br>
possible expressions (probably impossible). Is there more granular access to<br>
the filterExpression than retrieving the whole string? That could allow me<br>
to build the JS programmatically, which could be possible.<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/Python-granular-access-to-rules-in-rule-based-renderer-tp5201632.html" target="_blank">http://osgeo-org.1560.x6.nabble.com/Python-granular-access-to-rules-in-rule-based-renderer-tp5201632.html</a><br>
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div>