Search for Variable given value v1

A Snippet from: hagchr

//Assign variables
Let>alarm_green=http
Let>alarm_orange=xyz
Let>alarm_red=ssh

//Create reference string to search
Let>refstring=alarm_green=%alarm_green%%CRLF%alarm_orange=%alarm_orange%%CRLF%alarm_red=%alarm_red%

//Value you are searching for
Let>searchstring=ssh

//Do the search
Let>tmp0=(?m)[^=\n]+(?==%searchstring%)
RegEx>tmp0,refstring,0,M,NM,0

If>NM>0
    MessageModal>M_1
ELSE
    MessageModal>Value not assigned to variable
EndIf

Select the code above to paste into your macro. Or: View Raw Text

Link: http://www.mjtnet.com/snip.htm?g=53e517a2e2b97

Forum Embed Code - click to select all then copy (CTRL-C):

When pasting into the forum do NOT modify the script code or it will not match what is in the database - create a new snippet instead!