Hello Friends,
I am stuck with some regexs , which are used to extract data from .MIB files. these files are used by SNMP trap notifications.
Correct Regexs:
StringRegExp($Value, '(?i)(?:traps\s)(\d*)(?: })',3) StringRegExp($Value, '(?i)(.*)(?:NOTIFICATION-TYPE\s)',3)
Incorrect Regex:
From the below mentioned Sample Data, I am interested in extracting the values for Description belonging to traps. The above regex will extract all the descriptions instead of the desired "traps".
Sample Data:
Plain Text
Prod_Name MODULE-IDENTITY LAST-UPDATED "201101151711Z" ORGANIZATION "Name" CONTACT-INFO "contact me " DESCRIPTION "MIB file for ProductName" ::= { CompName 2011 } FoundTrp1 NOTIFICATION-TYPE OBJECTS { eventDate, eventTime, NFname } STATUS current DESCRIPTION "Found_Trp" ::= { traps 1 } FoundTrp2 NOTIFICATION-TYPE OBJECTS { eventDate, eventTime, NFname } STATUS current DESCRIPTION "Found_Trp2" ::= { traps 2 } NFname OBJECT-TYPE SYNTAX DisplayString MAX-ACCESS accessible-for-notify STATUS current DESCRIPTION "Description of NFname" ::= { eventVars 11 }
Appreciate your help in advance.
Regards
Deltarocked