Skip to content

Filter with Regular Expressions

First: Wildcards

You may have noticed vScope’s match-filters which allows for wildcard search.

Example using Wildcards:

To show all servers having a program file named sql-something can be viewed by setting a wildcard in the Filter Pane: Installed Applications = *sql*.

Example of using wildcard matching in filters in tables

But there are situations where one wants to be more specific. In these cases you can use RegEx (Regular Expressions).

Regular Expressions

NOTICE: Regular Expressions in vScope should be written in Perl 

Regex can be viewed as a more advanced form of wildcards. Regex is a bit more advanced, but on the other hand it is far more powerful and makes you create search queries which may not be possible with a simple wildcard.

Regex-strings can be used almost anywhere in vScope where an input field for filtering or search is available. This includes the Filter Pane in Tables, when building a Tracker-case, or when using Free Text Search.

Example using Regex

In this example we want to show all VMware hosts with VMs using software named “sql”-something, but exclude those where the name includes the word “express”. This query comes in handy to calculate the license needs for Microsoft SQL. This is more difficult using wildcards since it would require two match-filters and vScope only has one. Instead, use Regex like below:

Build a Table with VMware Hosts like below. Then, set a filter on Guest Database Software = _regex:(?sui).*sql(?!.*express).*_

Use regular expressions in vScope Tables The result is a listing of all VMware host running VMs with a version of SQL, but where Express versions are excluded.

In this example we used: regex: = This tells vScope that the following is a Regular Expression (?sui) = case insensitive matching .* = Regex-lingo for wildcard .*SQL = Look for anything including SQL (?! ) = “negative look ahead” (?!.*express) = exclude results where express comes after SQL

Regex is a comprehensive language which has a lot of power. Read more about Regular Expressions, and then you can really go crazy in vScope!