@stdlib/regexp
Version:
Regular expressions.
42 lines (33 loc) • 995 B
Plain Text
{{alias}}()
Returns a regular expression to capture the last part of a POSIX path.
Returns
-------
re: RegExp
Regular expression.
Examples
--------
> var RE_BASENAME_POSIX = {{alias}}();
> var base = RE_BASENAME_POSIX.exec( '/foo/bar/index.js' )[ 1 ]
'index.js'
> base = RE_BASENAME_POSIX.exec( './foo/bar/.gitignore' )[ 1 ]
'.gitignore'
> base = RE_BASENAME_POSIX.exec( 'foo/file.pdf' )[ 1 ]
'file.pdf'
> base = RE_BASENAME_POSIX.exec( '/foo/bar/file' )[ 1 ]
'file'
> base = RE_BASENAME_POSIX.exec( 'index.js' )[ 1 ]
'index.js'
> base = RE_BASENAME_POSIX.exec( '.' )[ 1 ]
'.'
> base = RE_BASENAME_POSIX.exec( './' )[ 1 ]
'.'
> base = RE_BASENAME_POSIX.exec( '' )[ 1 ]
''
{{alias}}.REGEXP
Regular expression to capture the last part of a POSIX path.
Examples
--------
> var base = {{alias}}.REGEXP.exec( 'foo/bar/index.js' )[ 1 ]
'index.js'
See Also
--------