![]() You could create a regular expression if you have something similar to the following zone names: The final set of bracketed characters match a single digit from 0 through 9, inclusive.Įxample 4 showing a more complicated naming pattern.The letters HBA in the regular expression indicate that this exact sequence of characters must occur in the zone name.The bracketed characters (underscore and dash) indicate that the alphanumeric pattern must be followed by an underscore or a dash.The * (asterisk) following the brackets indicates that the bracketed characters occur 0 or more times.The bracketed characters indicate that the characters being matched are all letters (regardless of case) and numbers.After the required underscore, the parentheses indicate that the pattern contained within will be stored in the \1 variable.In this example, the zone naming convention uses the underscore to separate the zone name from the host name. The _ (underscore) means that the digits after S must be followed immediately by only an underscore character in the zone name.The sign indicates that the occurrence of the information in the preceding brackets has to exist 1 or more times.The characters in brackets indicate that what follows "S" must be a digit between 0 and 9, inclusive.This matches only an "S" at the beginning of the zone name. "S" represents the zone name and begins the expression.The regular expression can be broken into its components: The hostname alone is stored in the \1 variable. The outcome is a match of all zones beginning with S that are followed by any combination of digits, followed by an underscore, the alphanumeric hostname (m圜omputer1Name), an underscore or hyphen, the capital letters HBA, and a single digit (0-9). The regular expression that you could use to capture the host name would be: S _(*)HBA ![]() In this example, you use the regular expression to extract a Host name from the zone name. ![]() ![]() The hyphens between the variables provide an example of constant text which is inserted in the formatted output. Your output would thus be: hostname1-Miami-filer You could then use the following format to ensure output in your preferred format: \2-\1-\3 *?_( )_( )_( )_.*īecause there are three sets of parentheses, the variables \1, \2 and \3 would be populated. The following regular expression would do this. To do this, you need to capture the host name, data center, and device type fields in variables, and use them in the output. ![]() Constant text may also be inserted in the output, by adding it to the FORMAT field.įor example, if the zone naming convention is: _Īnd you might want the output to be in the format:. The variables can be used in the output format in any order. If multiple parenthetical statements occur, the variables are referenced numerically, from left to right. In a regular expression, variable values are created by parenthetical statements. The default setting is \1, which means that a zone name that matches the regular expression is replaced by the contents of the first variable created by the regular expression. The Java API supports several meta characters, the most straightforward being the dot “.When creating regular expressions for OnCommand Insight Automatic Resolution, you can configure output format by entering values in a field named FORMAT. Meta characters affect the way a pattern is matched in a way, they add logic to the search pattern. ![]()
0 Comments
Leave a Reply. |