<div dir="ltr">but try this:<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">for (var i=0, len = </span><span style="font-family:arial,sans-serif;font-size:13px">features.length</span><span style="font-family:arial,sans-serif;font-size:13px"> ; i < len; i++)</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"> {</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px"> if (features[i].attributes.color && </span><span style="font-family:arial,sans-serif;font-size:13px">features[i].attributes.color.indexOf('blue') >-1</span><span style="font-family:arial,sans-serif;font-size:13px">) {</span></div>
<div style><span style="font-family:arial,sans-serif;font-size:13px">  alert('it is a match');</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">}</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">}</span></div>
<div><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 Tue Topholm <span dir="ltr"><<a href="mailto:tt@sugee.dk" target="_blank">tt@sugee.dk</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Have a look how match works:<div><br></div><div><a href="http://www.w3schools.com/jsref/jsref_match.asp" target="_blank">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: <a href="tel:%2B45%2032%2013%2032%2032" value="+4532133232" target="_blank">+45 32 13 32 32</a><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><div><div class="h5"><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><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><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><div>Sent from the OpenLayers Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">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></div></div><br></div>
</blockquote></div><br></div>