Useful regular expressions

Regular expressions can be used in different Measure definitions, such as URI Pattern or Cookie Values. Regular expressions are very powerful but sometimes a little hard to write if not working with them regularly. This page shows useful Regular expressions frequently used in their AppMon Installation. You can use them to leverage regular expressions for your measures.

Besides the built-in Regular Expression Tester in most AppMon dialog boxes, you can also check out this online regex testing service: http://www.regextester.com/

See http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html for a documentation of regular expression syntax.

Pulling a value from a method argument (for example an XML field)

Parsing header/session/cookie/attrib

Just plug in (.*)

The following allows you to extract an email value from a key/value pair where the keyname is userid. This can be used for example when an email is passed in a Cookie.

Extracting part of a URI

(for example for a Business Transaction Split Measure)

Identify classes ending with a certain string (limited to [cls] or [bas])

Class RegEx
MyClass[cls] or MyOtherClass[bas]
(\[cls\]|\[bas\])

Extract string of a constant length

The following allows you to extract a string that is of 20 character length. The string of interest is the value after corellationid.

Full String Text: RegEx:
>>subtractResult= >>>result=2, corellationid=vamsitest987654321, _env= >>>locale=, tag=166, activation=wm6ed6e9c70-bcc3-11e2-81a2-e32be605e442, corellationid=(.{20})