Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

regex for SNMP MIB

$
0
0

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:

$array=StringRegExp($Value, '(?i)description*[\S\s]*?(?:")?.*(?:".*\S\s.*)', 3)

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


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>