How can I extract the information within parenthesis () from an event variable in Spectrum
search cancel

How can I extract the information within parenthesis () from an event variable in Spectrum

book

Article ID: 43661

calendar_today

Updated On:

Products

CA Spectrum

Issue/Introduction

I have an event variable that contains a number of characters. However, I am only interested in what is contained within a set of parenthesis (). How can I extract the information within parenthesis () from an event variable in Spectrum?

Environment

Release: Any version of Spectrum
Component:

Resolution

This can be done using a Event Procedure. The following is an example:

0xfff00003 E 20 P "CreateEventWithAttributes( { C CURRENT_MODEL },{H 0xfff00004 },SetEventAttribute(GetEventAttributeList(),{ U 101 },GetRegexp(GetEventAttribute({ U 1 }),{ S \"[(]([^)]+)\"} ,{ U 1 })))"

For the above Event Procedure, when the 0xfff00003 event is generated:

  • New event 0xfff00004 will be generated on the current model
  • New Event Variable 101 will be created
  • Existing Event Variable 1 will be checked for a left parenthesis "(" and everything after up to the right parenthesis ")" will be saved to Event Variable 101 which is passed to the new event 0xfff00004

The following is an example of the contents of the 0xfff00003 and 0xfff00004 events showing the values of Event Variables 1 and 101:

 

Jun 2, 2016 11:32:34 AM EDT Sim15090:Lab-A1

Event Variable 1: 

I just want what is inside of the parenthesis (This is what I want) nothing else.

Event Variable 101:  

This is what I want

System     0xfff00004
Jun 2, 2016 11:32:34 AM EDT Sim15090:Lab-A1

Event Variable 1

I just want what is inside of the parenthesis (This is what I want) nothing else.

System     0xfff00003