'use strict';

/**
* Regular expression to capture a filename extension.
*
* @module @stdlib/regexp/extname
* @type {RegExp}
*
* @example
* var RE_EXTNAME = require( '@stdlib/regexp/extname' );
*
* // On a POSIX platform...
* var ext = RE_EXTNAME.exec( '/foo/bar/index.js' )[ 1 ];
* // returns '.js'
*
* @example
* var RE_EXTNAME = require( '@stlib/regexp/extname' );
*
* // On a Windows platform...
* var ext = RE_EXTNAME.exec( 'C:\\foo\\bar\\index.js' )[ 1 ];
* // returns '.js'
*/

// MODULES //

var copy = require( '@stdlib/utils/copy' );
var isWindows = require( '@stdlib/utils/is-windows' );


// MAIN //

var posix = require( '@stdlib/regexp/extname-posix' );
var win32 = require( '@stdlib/regexp/extname-windows' );

var re;
if ( isWindows ) {
	re = win32;
} else {
	re = posix;
}
re = copy( re );


// EXPORTS //

module.exports = re;
module.exports.posix = posix;
module.exports.win32 = win32;

@@ -489,24 +489,96 @@
 MODULES //%0A%0A
+var setReadOnly = require( '@stdlib/utils/define-read-only-property' );%0A
 var copy = r
@@ -613,25 +613,26 @@
  );%0Avar 
-isWindows
+IS_WINDOWS
  = requi
@@ -800,34 +800,51 @@
 var 
-re;%0Aif ( isWindows ) %7B%0A%09re
+RE_EXTNAME;%0Aif ( IS_WINDOWS ) %7B%0A%09RE_EXTNAME
  = w
@@ -859,18 +859,26 @@
 else %7B%0A%09
-re
+RE_EXTNAME
  = posix
@@ -885,119 +885,170 @@
 ;%0A%7D%0A
-re = copy( re );%0A%0A%0A// EXPORTS //%0A%0Amodule.exports = re;%0Amodule.exports.posix = posix;%0Amodule.exports.win32 = win32
+RE_EXTNAME = copy( RE_EXTNAME );%0A%0AsetReadOnly( RE_EXTNAME, 'posix', posix );%0AsetReadOnly( RE_EXTNAME, 'win32', win32 );%0A%0A%0A// EXPORTS //%0A%0Amodule.exports = RE_EXTNAME
 ;%0A

Set read only properties