This is driving me nuts, but I can't make this very simple regular expression work. I have a JSON object, and I am trying to sum all of the properties that start with "eehrs_" (the values for these properties are all integers). Just to debug it, I am trying to simply print out the property name to show that the loop is working. Here is the regular expression and loop I am using. Any help would be greatly appreciated:
for (i = 0; i < schoolJSON.features.length; i++) {
for (property in schoolJSON.features[i].properties) {
if (property == /(eehrs_\d+)|(eehrs_[p|k])/) {
console.log(property);
}
}
}
Also, I tried using a simple /^eehrs_/, but that did not work either.
Thanks, Jon