You are currently offline, waiting for your internet to reconnect

The shExpMatch function in .pac files does not support regular expressions

This article was previously published under Q274204
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
When you use the shExpMatch function in .pac files, advanced regular expression syntax does not work in Internet Explorer.
The shExpMatch function is used in .pac files to match the current URL against any shell expression. In addition, shExpMatch is usually used to decide which proxy to use depending on the URL that is entered. In Internet Explorer, the support for shell expressions is limited to "?" and "*" in the expressions. This is by design.

Because .pac files support the entire JavaScript language, you can use a regular expression object and the test method to test a string against a regular expression. The following code sample illustrates the use of the regular expression object in a .pac file:
function FindProxyForURL(url, host){// For instance, if the server has 4 alphabetic characters, // such as "MSDN", route it through a specific proxy: var regexpr = /[a-zA-Z]{4};if(regexpr.test(host))    return "PROXY w3proxy:8080; DIRECT";// Or else connect directly:return "DIRECT";}				
For more information about the .pac file syntax, visit the following Netscape Web site:For more information on regular expressions, visit the following Mozilla Web site:Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.

Article ID: 274204 - Last Review: 07/05/2007 16:47:25 - Revision: 3.1

  • Microsoft Internet Explorer 4.0 128-Bit Edition
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer 4.01 Service Pack 1
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer 5.0
  • Microsoft Internet Explorer 5.01
  • Microsoft Internet Explorer (Programming) 5.01 SP1
  • Microsoft Internet Explorer 5.5
  • kbinfo kbscript KB274204