- print_to_socket (fh, "%i Value%s found\n",
- (int) number, (number == 1) ? "" : "s");
- for (i = 0; i < number; i++)
- print_to_socket (fh, "%u %s\n", (unsigned int) times[i], names[i]);
+ status = parse_identifier_vl (names[i], &vl);
+ if (status != 0)
+ continue;
+
+ /* If a regex exists and doesn't match, ignore this value and continue
+ * with the next one. */
+ if (have_re_host && (regexec (&re_host,
+ /* string = */ vl.host,
+ /* nmatch = */ 0,
+ /* pmatch = */ NULL,
+ /* flags = */ 0) == REG_NOMATCH))
+ continue;
+ if (have_re_plugin && (regexec (&re_plugin,
+ /* string = */ vl.plugin,
+ /* nmatch = */ 0,
+ /* pmatch = */ NULL,
+ /* flags = */ 0) == REG_NOMATCH))
+ continue;
+ if (have_re_plugin_instance && (regexec (&re_plugin_instance,
+ /* string = */ vl.plugin_instance,
+ /* nmatch = */ 0,
+ /* pmatch = */ NULL,
+ /* flags = */ 0) == REG_NOMATCH))
+ continue;
+ if (have_re_type && (regexec (&re_type,
+ /* string = */ vl.type,
+ /* nmatch = */ 0,
+ /* pmatch = */ NULL,
+ /* flags = */ 0) == REG_NOMATCH))
+ continue;
+ if (have_re_type_instance && (regexec (&re_type_instance,
+ /* string = */ vl.type_instance,
+ /* nmatch = */ 0,
+ /* pmatch = */ NULL,
+ /* flags = */ 0) == REG_NOMATCH))
+ continue;
+
+ matching_names[matching_number] = names[i];
+ matching_times[matching_number] = times[i];
+ matching_number++;
+ }
+
+ print_to_socket (fh, "%zu Matching value%s\n",
+ matching_number, (matching_number == 1) ? "" : "s");
+ for (i = 0; i < matching_number; i++)
+ print_to_socket (fh, "%.3f %s\n",
+ CDTIME_T_TO_DOUBLE (matching_times[i]),
+ matching_names[i]);
+ }