2008-10-28

[Opsware] Regular expressions in CML continued

This is a follow up from my first post about CML reg exps.

#1 - Use double quotes.

Do not use single quotes like in the docs. That is certain.

#2 - Parenthesis not used that I can tell.

A CML delimited reg exp like this:

r"(one)|(two)|(three)"

...is pointless use of parenthesis unless Opsware plans on playing back the regular expressions later the way Apache's mod_rewrite can. If that were the case, then "$1" would play back the match from the reg exp "one". This sure would be useful in the drop-down list box in the SAS client when filling in values. The user could see all the possible legal values listed. However, SAS client does not do this.

The use of a single set of parenthesis is no better.

r"(one|two|three)"

The simpler regular expression:

r"one|two|three"

...works just fine. Of course, one would expect this to be true, but in the veiled deep that is Opsware, I feel that specifying it is necessary.

No comments:

Post a Comment