/**
 * STRING-UTILS.JS
 *
 * String utility functions.
 *
 * Author         Dave Snyckers [X-Cago BV]
 */


/**
 * Replace all regular expression matches with a specified string.
 *
 * param  source    the source string
 * param  regexp    the regular expression to match
 * param  replace   the string to use as the replacement
 */
function replaceAll( source, regexp, replace )
{
  var result = source;

  while( result.search( regexp ) != -1 )
    result = result.replace( regexp, replace );

  return result;
}