[wpkg-users] TQ: Best practice for RegExp use

Stefan Pendl stefan.pendl.71 at gmail.com
Mon Jul 18 23:56:19 CEST 2011


Hello,

I have since used the following to match multiple hosts:

name="CAD[0-9]+|CAM[0-9]+"

This matches hosts like CAD09, CAD35, CAM02, CAM15, etc.

Now in a recent message it was suggested to change those patterns into the following, if one uses the "hostname" instead of the
"name" attribute.

hostname="^(CAD[0-9]+|CAM[0-9]+)$"

I have already used the hostname attribute to change package variables for individual groups of hosts.
They use the hostname attribute, but the old pattern and they work so far.

Can anyone with deeper knowledge of WSH RegExp advice how to proceed?
Might be good to point out the pros and cons, or do and don't.

We could then update the documentation to include the best practice advice.

---
Stefan




More information about the wpkg-users mailing list