Knowledge Base Administration Guide

Regular Expressions (Regex)

Simscope supports Regular Expressions for many search fields, used in:

This is based on the Google RE2 library:

View RE2 Regexp Syntax Documentation


Basic Regex Examples

To search for a string containing abc followed by xyz, with any number of characters in the middle use .*:

  • abc.*xyz

To search for foo followed by 1 or more digits:

  • abc[0-9]+

Match at beginning of string, or end of string

To search for hello at the beginning of a string, prefix your expression with ^ (caret):

  • ^hello

To search for smoke at the end of a string, suffix your expression with $ (dollar):

  • smoke$

Logical-OR expressions

To match ONE or more of multiple possibilities, use the | (pipe) operator.

For example, to search for regressions containing daily or weekly:

  • daily|weekly

Logical-AND expressions

To match ALL of multiple regular expressions (in any order), combine them with the , (comma) operator.

For example, to search for dev and daily (whether daily comes first or dev comes first):

  • dev,daily

NOTE: the , operator cannot be nested inside parenthesis. For example: (foo,bar) is not allowed. However: (foo|bar),baz is allowed.


Inversion (NOT expressions)

To invert a regular expression, prefix your expression with ! (exclamation mark).

For example, to search for regressions that do not contain dev:

  • !dev

This can also work with OR expressions. For example, to search for regressions that do not contain dev nor weekly:

  • !(dev|weekly)

NOTE: the ! operator cannot be nested inside parenthesis. For example, (!foo|bar) is not allowed. However, !(foo|bar) is allowed.


Advanced expressions

Here are a few sample expressions to show how multiple terms work:

RegexMeaning
!foo|barContains NEITHER foo nor bar
!(foo|bar)(Equivalent to above, except with parenthesis)
!foo,!bar*(Equivalent but using ANDs)
NOT contains foo AND NOT contains bar
alpha,!betaContains alpha AND does NOT contain beta
!alpha,betaNOT contains alpha AND does contain beta
alpha|beta.*foo|barContains alpha OR (contains beta followed by foo) OR contains bar

Case Sensitivity

Regexes are by default case sensitive.

To switch to case-insensitive mode, add the following prefix to your expression:

  • (?i)

For example, to match Daily or daily or DAILY:

  • (?i)daily