Can the GetRegexp used in a Spectrum Event Procedure be configured to be case insensitive?

Document ID : KB000057344
Last Modified Date : 14/02/2018
Show Technical Document Details

QUESTION: Can the GetRegexp used in a Spectrum Event Procedure be configured to be case insensitive?

 

ANSWER:  By default, the GetRegexp used in a Spectrum Event Procedure is case sensitive. The following are the instructions on how to configure the GetRegexp to be case insensitive.

The following is an example of an Event Procedure using GetRegexp:

0xfff00000 E 50 P " \

CreateEventWithAttributes( \

{C CURRENT_MODEL}, \

{H 0xfff00001}, \

SetEventAttribute( \

GetEventAttributeList(), \

{U 100}, \

GetRegexp(GetEventAttribute( \

{U 1}), \

{S \"Check *(.*)\"}, \

{U 1} )))"

In the above example, the Event Procedure will look for the word "Check" in event variable 1 of event 0xfff00000. If found, it will store the text to the right of "Check" to event variable 100 for event 0xfff00001. But what if the word "Check" in event variable 1 could come out as "check" or "Check" or CHECK? The way the Event Procedure is written above, event variable 100 will only be populated for event 0xfff00001 if it matches "Check" exactly. If it comes across as "check" or "CHECK", event variable 100 will not be populated for event 0xfff00001.

The following is an example of how to configure the above Event Procedure to make the GetRegexp match case insensitive:

0xfff00000 E 50 P " \

CreateEventWithAttributes( \

{C CURRENT_MODEL}, \

{H 0xfff00001}, \

SetEventAttribute( \

GetEventAttributeList(), \

{U 100}, \

GetRegexp(GetEventAttribute( \

{U 1}), \

{S \"(?i)Check *(.*)\"}, \

{U 1} )))"

Notice the (?i) in front of the word "Check". By adding (?i) in front of the word "Check", it makes the GetRegexp match case insensitive. So, if the word comes across as "Check", "check", "CHECK" or any combination of case, the GetRegexp will result in a true condition and event variable 100 will be populated for event 0xfff00001.