AnsweredAssumed Answered

JS calculator - find most recent date (larges integer) regex

Question asked by jkutes1.1 on Feb 7, 2013
Latest reply on Feb 8, 2013 by KPalmer
Hi,
I need a help with finding a way how to match to the most recent date within the metric name (release date in this case), for a javascript calculator to work properly only on a specific subset of metrics.
The problem is that with rapid releases, I'll have 2 or 3 sets of metrics (based on different dates in the metric name) returned.
Since there is an alert based on this calculator i have false alerts fired, because the regex can return metrics for old release rather than the most recent one.

I have regex below to start with, but need something more fancy way to accomplish above.
Basically problem boils down to finding find larger integer in the set of strings/metrics.
Otherwise with every release, I'd have to update the date to match the proper metric set.


function getMetricRegex()
{
return "Backends\\|pjpr(.*)20130124(.*)P_GETLOGININFO(.*):(.*)";
}



metric name example:
.*(Oracle DB)|SQL|Stored Procedures|Query|{ CALL CIFPROC.PKG_PARTY_WEB20130124.P_GETLOGININFO (?, ?, ...) }

date format (represented in the metric name as integer):
YYYYMMDD

Example of metrics with dates i may have in the SmartStore:
(.*)20121230(.*)
(.*)20130101(.*)
(.*)20130102(.*)

Any constructive help greatly appreciated.
I'm interested only in programmatic ways how to address this.

Thank you!

Outcomes