<div dir="ltr">Have a look how match works:<div><br></div><div><a href="http://www.w3schools.com/jsref/jsref_match.asp">http://www.w3schools.com/jsref/jsref_match.asp</a><br></div></div><div class="gmail_extra"><br clear="all">
<div><br>--<br><br>Med venlig hilsen / Kind regards<br><br>Tue Topholm<br>Sugee<br>Tlf: +45 32 13 32 32<br>W: <a href="http://www.sugee.dk" target="_blank">http://www.sugee.dk</a></div>
<br><br><div class="gmail_quote">2012/12/26 Xavier Mamano (jorix) <span dir="ltr"><<a href="mailto:xavier.mamano@gmail.com" target="_blank">xavier.mamano@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
This means that for some feature has no attribute color,<br>
<br>
so check before `if(features[i].attributes.color &&<br>
features[i].attributes.color.match ...`<br>
<br>
Regards,<br>
<div class="im"><br>
<br>
I used to filter my features using:<br>
<br>
for (var i=0; i<features.length; i++)<br>
 {<br>
 if (features[i].attributes.color == 'blue')<br>
.<br>
.<br>
<br>
<br>
but sometimes the value could be: dark blue, light blue .. etc<br>
So I used match but still can't get it work:<br>
<br>
</div>var x = &quot;blue&quot;;<br>
 if (features[i].attributes.color.match(new RegExp(x, &quot;ig&quot;)))<br>
<div class="im"><br>
I get this error:<br>
Cannot call method 'match' of undefined<br>
</div>&lt;/quote><br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/Features-Attributes-Matching-tp5023291p5024672.html" target="_blank">http://osgeo-org.1560.n6.nabble.com/Features-Attributes-Matching-tp5023291p5024672.html</a><br>

<div class="HOEnZb"><div class="h5">Sent from the OpenLayers Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</div></div></blockquote></div><br></div>