VerbalExpressions is a JavaScript library that helps to construct difficult regular expressions.

// Create an example of how to test for correctly formed URLs
var tester = VerEx()
            .then( "http" )
            .maybe( "s" )
            .then( "://" )
            .maybe( "www." )
            .anythingBut( " " )

// Create an example URL
var testMe = "";

// Use RegExp object's native test() function
if( tester.test( testMe ) ) alert( "We have a correct URL "); // This output will fire
else alert( "The URL is incorrect" );

console.log( tester ); // Ouputs the actual expression used: /^(http)(s)?(\:\/\/)(www\.)?([^\ ]*)$/


Dictionary VS Hashtable differences:

  • Generic <<<>>> Non-Generic
  • Needs own thread synchronization <<<>>> Offers thread safe version through Synchronized() method
  • Enumerated item: KeyValuePair <<<>>> Enumerated item: DictionaryEntry
  • Newer (> .NET 2.0) <<<>>> Older (since .NET 1.0)
  • is in System.Collections.Generic <<<>>> is in System.Collections
  • Request to non-existing key throws exception <<<>>> Request to non-existing key returns null
  • potentially a bit faster for value types <<<>>> bit slower (needs boxing/unboxing) for value types

Dictionary / Hashtable similarities:

  • Both are internally hashtables == fast access to many-item data according to key
  • Both need immutable and unique keys
  • Keys of both need own GetHashCode() method

Similar .NET collections (candidates to use instead of Dictionary and Hashtable):

  • ConcurrentDictionarythread safe (can be safely accessed from several threads concurrently)
  • HybridDictionaryoptimized performance (for few items and also for many items)
  • OrderedDictionary – values can be accessed via int index (by order in which items were added)
  • SortedDictionary – items automatically sorted
  • StringDictionary – strongly typed and optimized for strings