Overview
Catchpoint uses Regular Expressions(regex or regexp) to search for data within strings. Regex is a special string that describes a search pattern to be applied to other text. Catchpoint follows the .NET syntax for regular expressions.
Regex Characters
Regex contains a wide range of functions that allow for robust search patterns. Below are common regex characters and patterns used by Catchpoint users.
| Regex | Description | Example Pattern | Sample Match |
| \d | Digit | id="\d\d" | id="23" |
| \s | White space | Hello\sWorld | Hello World |
| \D | Anything not a digit | \D\D\D1 | one1 |
| . | Any character except line break | a.c | abc |
| \. | Period | .\.com | g.com |
| \ | Escapes special characters | \<title\> | <title> |
| .* | Any number of characters | .*com | google.com |
| .+ | At least one or more | .+com | yahoo.com |
| (..) | Capturing Group | www\.(.+)\.com | google (from string www.google.com) |
Please note that Catchpoint supports only one capture group at a time. In order to capture multiple patterns, using alternation ( | ) in one capture group is encouraged. For example, (firstPattern | secondPattern) could be used to capture firstPattern OR secondPattern.
Using the above regex options, powerful search patterns can be created. Here are common patterns used in Catchpoint tests:
| Sample Pattern | Description |
|---|---|
| <title>(.*)</title> | Capture any/all text between title tags |
| set-cookie:(.*) | Capture a cookie in a header |
| User-Agent:(.*) | Capture the user agent |
| .*\.google-analytics\.com.* | Find anything coming from google-analytics |
| https://www.google.com/\?gws_rd=ssl#q=(.+) | Capture search string from Google url |
| Insight Key:(.*) | Capture insight value after key. |
Please do not use the expression "*" standalone in any "Apply To" field, instead if you want to match all the characters please use the ".*" expression.
See Also:
For more information regarding Regular Expressions, please see the Regex Cheat sheet provided by rexegg.com.
Regex101 is one of the popular tools for regex testing.