Regular Expressions / GREPMATCHES



The information in this article applies to:

• Prism Deploy v5

• Prism Pack v5

What is GREPMATCHES?

GREPMATCHES is a comparison operator that is available within the Prism Deployment Console when creating User-Defined Configuration Groups and within Prism Package Editor when defining Installation Rules. GREPMATCHES is based on a language called Regular Expressions that is a way of searching for complex patterns in text. Many tools incorporate regular expressions including UNIX-oriented command lines, text editors and programming languages. Prism includes GREPMATCHES as a tool for advanced administrators who have a need to search for specific criteria that cannot be met by the simpler comparison operators. Or perhaps an administrator skilled at regular expressions can more easily set up a rule.

It is outside the scope of the Prism documentation and New Boundary Support Team to teach all the aspects of regular expressions. However, this document has been compiled to offer you resources and examples to help familiarize yourself with the tool.

Web Resources:

http://gnosis.cx/publish/programming/regular_expressions.html

http://etext.lib.virginia.edu/helpsheets/regex.html

http://sitescooper.org/tao_regexps.html

Published Resources:

Mastering Regular Expressions by Jeffrey E. F. Freidl (published by O'Reilly & Associates, Inc.).

Regular Expression Pocket Reference by Sarah Burcham, Tony Stubblebine (published by O'Reilly & Associates, Inc.).

Notes:

· GREPMATCHES is not case-sensitive.

Examples of use with Prism 5:

Search for “oracle” anywhere in the path statement within the registry on NT/2000/XP computers.

"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\\PATH" GREPMATCHES "(oracle)"

Search for “d:\oracle” anywhere in the Path statement.

"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\\PATH" GREPMATCHES "(d\:\\oracle)"

Search for “d:\oracle” at the beginning of the Path statement.

"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\\PATH" GREPMATCHES "^(d\:\\oracle)"

Search for “d:\oracle” at the end of the Path statement.

"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\\PATH" GREPMATCHES "(d\:\\oracle)$"

Search the registry value PATHEXT for “.com;” as its first delimited value.

"HKLM\System\CurrentControlSet\Control\Session Manager\Environment\\PathExt" GREPMATCHES "^\.com;*"

Read the Computer DNS Name for computers with the suffix “.domain.local”

ComputerDNSName GREPMATCHES ".*\.(domain.local)$"

Search computers that have an IP Address within the range 192.168.3.*

IPAddress GREPMATCHES "192\.168\.3\.[0-9]+"

Match contains computers with any of these letters as the first letter of their cd-rom drive: d: or E:

FirstCDLetter GREPMATCHES "[D-E]"