[OpenLayers-Users] OpenLayers.Filter.Comparison.LIKE doesn't filter special characters!

Matt Priour mpriour at kestrelcomputer.com
Thu Jan 3 05:56:18 PST 2013


LIKE creates a regex from the string. So if you have characters with 
special regex meaning, then you need to escape them.

See 
https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions#Using_Special_Characters 
for the special characters

Matt Priour

On 1/2/2013 10:22 AM, Diego M. wrote:
> it seems like OpenLayers.Filter.Comparison.LIKE doesn't filter special
> characters!
> for example,
>
> filter = new OpenLayers.Filter.Comparison({
>      type: OpenLayers.Filter.Comparison.LIKE,
>      property: 'name',
> 	value: 'blue'
>      })
>
> this will work fine. but:
>
> filter = new OpenLayers.Filter.Comparison({
>      type: OpenLayers.Filter.Comparison.LIKE,
>      property: 'name',
> 	value: 'light-blue'
>      })
>
> this will cause an error because of the -
> it also can't deal with dots
>
> what can I do to fix that ?
>
>
>
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/OpenLayers-Filter-Comparison-LIKE-doesn-t-filter-special-characters-tp5025321.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>




More information about the Users mailing list