SMARTS: Clarification on ASL pattern matching syntax
search cancel

SMARTS: Clarification on ASL pattern matching syntax

book

Article ID: 304280

calendar_today

Updated On:

Products

VMware

Issue/Introduction

Symptoms:


I want to write a rule that matches a pattern that has any number of words before the string "measured at"  and copies these words into a variable that I can use in the event name.

Clarification on ASL pattern matching syntax

Environment

VMware Smart Assurance - SMARTS

Resolution

START {
    .. eol } do {
    test( "NPE measured at 50C/122F" );
    test( "NPE Inlet measured at 44C/111" );
    test( "Really Big NPE Inlet measured at 44C/111" );
}

test(s) {
    input = s;
    local device;
    local temperature;
    local end = "";
    device:rep( not("measured") word )?

    "measured" "at"
    temperature:word

    eol 

} do {
 print( "device... ".device );
 print( "temp..... ".temperature );
}   --------------OUTPUT------------------------------
device... NPE
temp..... 50C/122F
device... NPE Inlet
temp..... 44C/111
device... Really Big NPE Inlet
temp..... 44C/111