Sanibel Logic LLC

...Scalable Technologiesfor the Enterprise

Regular Expression Syntax Testing and Validation

Another common question I get some from licensees of SSLRedirect, HttpCompressionAgent and nUrlRewriter is how to construct meaningful Regular Expressions which will match an incoming URL for the licensee's intended conditions.   Of course, it is my intention to use Regular Expressions within these products because Regular Expressions are an effective tool for testing a broad range of conditions.  However, it is not my intention to educate you on Regular Expression syntax.  I have found a number of Internet sources for such Regular Expression syntax knowledge....simply by Googling "Regular Expressions".

I did develop a Test Regular Expression web page, which allows you to key in an incoming string, followed by a Regular Expression string to see if the Regular Expression will match the incoming string.  CLICK HERE to use this Regular Expression test web page.

The Test Regular Expression web page is illustrated below:

RETest

Regular Expression String Encoding

Sanibel Logic has a number of products which utilize Regular Expressions.  One common question asked by licensees is how to encode Regular Expression strings within the web.config file.  Because the web.config conforms to rules for HTML encoding, any such string must first be HTML encoded, as provided by the .NET System.Web.HttpUtility.HtmlEncode method.  After the string is HTML encoded then we must consider Regular Expression special characters, which must be escaped and include the following special characters:

  • "\" - Backslash
  • "^" - Carat
  • "." - Period
  • "[" - Left bracket
  • "$" - Dollar sign
  • "(" - Left parenthesis
  • ")" - Right parenthesis
  • "|" - Pipe
  • "*" - Asterisk
  • "+" - Plus
  • "?" - Question mark
  • "{" - Left curly bracket

SSLRedirect uses Regular Expression values within the web.config SSLRedirect configuration section, within the urlsIn and urlsOut Xml tags.

HttpCompressionAgent also uses Regular Expression values within its web.config HttpCompression configuration section, within the mimeTypes, urls, assemblies and urlReferrers Xml tags.

To shortcut the process of browsing the Internet, so one can determine how to HTML encode and properly allow for Regular Expression special characters, I have written a basic web transaction which will transform an input Regular Expression string.   Click HERE to try the Regular Expression transformation web transaction.

Sample output from the Regular Expression Transformation web transaction is included for your benefit below...

Regular Expression Transformation Web Transaction

HttpCompressionAgent - A Must Have Compression Module...

HttpCompressionAgent continues to provide incredible compression efficiencies for HTTP data streams, providing between 70%-95% reduction in overall data stream size.  Of course one of the added features is that embedded resources (WebResource.axd HTTP requests) are also compressed.  Just listen to what third parties are saying in a recent Internet forum session...

"...I decided to try HTTPCompressionAgent from Sanibel Logic. Although DNN has built in compression, I decided to try this module as it was supposed to compress a few things DNN didn't.

What I found was that for me this is a MUST HAVE WITH LISTX! If you have ever done any performance analysis on your site against ListX, you will notice that ANY ListX module you have is NOT compressed IF you have AJAX enabled. I loaded up HTTPCompressionAgent from Sanibel and low and behold... now ALL my ListX AJAX enabled modules are compressed. It's made a HUGE difference...."

HttpCompressionAgent also works flawlessly with the latest of ASP.NET features, such as ASP.NET 3.5 extensions, AJAX, etc...

"...Well, after buying and trying this module, I have to say it so far seems to work flawlessly on compressing the .AXD's. Plus the support is instant (Sunday afternoon < 2 hour email response). I have to second the endorsement on this one, if it works on our crazy site with all our compression stuff and assorted modules, for sure it will work wonders on basic setups..."

Please don't take my word for it. CLICK HERE to read the entire forum exchange.