function regexp2json( re ) {
	var i;
	if ( !isRegExp( re ) ) {
		throw new TypeError( format( 'invalid argument. Must provide a regular expression. Value: `%s`.', re ) );
	}
	re = re.toString();
	for ( i = re.length-1; i >= 0; i-- ) {
		if ( re.charCodeAt( i ) === SLASH ) {
			break;
		}
	}
	return {
		'type': 'RegExp',
		'pattern': re.substring( 1, i ),
		'flags': re.substring( i+1 )
	};
}
Returns a JSON representation of a regular expression.

@param {RegExp} re - regular expression to serialize
@throws {TypeError} must provide a regular expression
@returns {Object} JSON representation

@example
var json = regexp2json( /ab+c/ );
// returns {...}