# Special Cases and Regular Expressions

## Special use for zero in upper bounds

In points rules, where the upper bound of an individual test is numeric, you can use a zero
as a special case that (once you leave the field) is displayed as `Any
number`. In the same test, a numeric lower limit normally uses zero just as
a zero, without special meaning. Therefore if you set both lower and upper bounds of an
individual test to zero, this means that every installation measured with this individual
test will pass.

Of course, keep in mind all criteria (or individual tests) within any one rule must match before an installation is considered matched by the rule as a whole.

## Regular expressions

A few values allow for matching by regular expressions. (A *regular expression* means
the use of special character combinations to match any of a whole set of values. For
example, the regular expression `[0-9]` will match any single digit.)

- If the value is exactly an asterisk (
`*`) with no white space, it will match any value from an installation.This is considered the least specific rule — in evaluating rule sets from different licenses against a particular software installation, the most specific match is always the one used. Therefore a rule with any value other than`*`for the same test will always be preferred over one with just an asterisk.Tip: Keep in mind that all the rules creates in your enterprise (these have a Source value of`Local`) are processed first, so that your customized rules always have priority. Therefore in your local rules, a more specific setting is preferred over an asterisk; subsequently, when rules delivered through the Application Recognition Library are processed, the more specific setting within those rules is preferred over an asterisk. - Otherwise, the rule value is split on white space and considered as a series of separate regular expressions. Each is considered in turn against the inventory value from an installation. Only if all these regular expressions (in any order) are matched somewhere within the inventory value, will this individual test within the rule pass.
- The special characters for the regular expression are those defined for Microsoft
.NET, and documented at http://msdn.microsoft.com/en-us/library/az24scfc.aspx
(
*Regular Expression Language - Quick Reference*). - When you need to use one of the special characters used in defining the regular
expression as its own literal value in a test, 'escape' it by preceding it with a
backslash. Thus a period (
`.`) stands for any single character in a regular expression, but backslash-period (`\.`) just means period. - All comparisons are case-insensitive.

**Examples**

- You want to define a Processor type that matches an IBM Cell
Broadband Engine 8i processor. This processor returns in inventory as
`Cell/B.E.`and the periods in the name will be interpreted as a regular expression. To make them literal periods, escape them as follows:`Cell/B\.E\. 8i`

- You want to create a rule where the Processor type will match any
of three different Intel Xeon processor models, and assign 120 points to each. For this
rule, there are two separate uses of square brackets in regular expressions. A few
characters within the brackets stands for 'any one of these' (
`[67]`

means either a six or a seven); while adding a dash converts the meaning to 'any one value from this range' (`[0-9]`

means any single digit). Therefore the following regular expression matches the`Intel(R) Xeon(R) CPU X6520 @ 2.67GHz`, and the`X6550`, and the`X7542`:`Xeon [67]5[0-9][0-9]`

- Here are three different regular expressions for applying the Processor
type test apply to IBM computers. Remember that individual terms in your
test must be separated only by spaces, that the order of terms within the expression does
not matter, and that all the terms in one regular expression must be matched before an
installation can consume under this rule:
- To apply a rule for all IBM processors:
`IBM`

- To identify just IBM PowerEdge 520
processors:
`520 IBM PowerEdge`

- To identify only IBM Power4 and IBM Power5
processors:
`IBM Power(4|5)`

- To apply a rule for all IBM processors: