Difference between revisions of "Regular expression support"
Line 7: | Line 7: | ||
Quick examples: | Quick examples: | ||
− | <host name="b[0-9] | + | <host name="b[0-9] " profile-id="profile" /> |
works for: b1, b10, b100 | works for: b1, b10, b100 | ||
Line 13: | Line 13: | ||
− | <host name=". | + | <host name=". " profile-id="profile" /> |
works for *all* hosts - use with care (!), place at the bottom of hosts.xml | works for *all* hosts - use with care (!), place at the bottom of hosts.xml | ||
− | <host name="b. | + | <host name="b. " profile-id="profile1" /> |
works for "b10", "b11", "b12345" etc. | works for "b10", "b11", "b12345" etc. | ||
− | <host name="b. | + | <host name="b. " profile-id="profile2" /> |
<host name="bronek1" profile-id="profile1" /> | <host name="bronek1" profile-id="profile1" /> | ||
− | <host name="bron. | + | <host name="bron. " profile-id="profile3" /> |
Normally, hosts are parsed from top to the bottom, except when the hostname is not a regular expression. | Normally, hosts are parsed from top to the bottom, except when the hostname is not a regular expression. | ||
− | So host "bronek1" will match "profile1", even though it also matches "b. | + | So host "bronek1" will match "profile1", even though it also matches "b. " and "bron. " (which are regular expressions). |
Line 45: | Line 45: | ||
Now it matches "pc", and only "pc". | Now it matches "pc", and only "pc". | ||
− | To match "pc001", "pc002", "pcABC", you have to use "pc. | + | To match "pc001", "pc002", "pcABC", you have to use "pc. ". |
Revision as of 03:22, 12 April 2007
WPKG has regular expression support for hosts defined in hosts.xml file.
You can view the exact syntax on this page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/jscript7/html/jsjsgrpregexpsyntax.asp
Quick examples:
<host name="b[0-9] " profile-id="profile" />
works for: b1, b10, b100 does not work for: bubu, b, x, x1, x10, x100
<host name=". " profile-id="profile" />
works for *all* hosts - use with care (!), place at the bottom of hosts.xml
<host name="b. " profile-id="profile1" />
works for "b10", "b11", "b12345" etc.
<host name="b. " profile-id="profile2" /> <host name="bronek1" profile-id="profile1" /> <host name="bron. " profile-id="profile3" />
Normally, hosts are parsed from top to the bottom, except when the hostname is not a regular expression. So host "bronek1" will match "profile1", even though it also matches "b. " and "bron. " (which are regular expressions).
Note
The behaviour of regular expressions changed slightly in WPKG 0.9.7.
Previously, a host name:
<host name="pc" profile-id="profile2" />
would match all hosts that contain "pc" in the name.
Now it matches "pc", and only "pc".
To match "pc001", "pc002", "pcABC", you have to use "pc. ".
The change was introduced to ease the maintenance of hosts.