[OpenLayers-Users] Features Attributes Matching
Tue Topholm
tt at sugee.dk
Wed Dec 26 09:29:28 PST 2012
Have a look at this (http://www.w3schools.com/jsref/jsref_regexp_test.asp), because you use the match wrong.
another way to do it, is using indexOf
Den 16/12/2012 kl. 12.38 skrev Diego M. <oo_O2_oo at hotmail.com>:
>
> I used to filter my features using:
>
> for (var i=0; i<features.length; i++)
> {
> if (features[i].attributes.color == 'blue')
> .
> .
>
>
> but sometimes the value could be: dark blue, light blue .. etc
> So I used match but still can't get it work:
>
> var x = "blue";
> if (features[i].attributes.color.match(new RegExp(x, "ig")))
>
> I get this error:
> Cannot call method 'match' of undefined
>
>
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/Features-Attributes-Matching-tp5023291.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