54 lines
1.5 KiB
Plaintext
54 lines
1.5 KiB
Plaintext
|
|
||
|
{{alias}}()
|
||
|
Returns a regular expression to split a POSIX filename.
|
||
|
|
||
|
When executed, the regular expression splits a POSIX filename into the
|
||
|
following parts:
|
||
|
|
||
|
- input value
|
||
|
- root
|
||
|
- dirname
|
||
|
- basename
|
||
|
- extname
|
||
|
|
||
|
When executed against dotfile filenames (e.g., `.gitignore`), the regular
|
||
|
expression does not capture the basename as a filename extension.
|
||
|
|
||
|
Returns
|
||
|
-------
|
||
|
re: RegExp
|
||
|
Regular expression.
|
||
|
|
||
|
Examples
|
||
|
--------
|
||
|
> var RE = {{alias}}();
|
||
|
> var parts = RE.exec( '/foo/bar/index.js' ).slice()
|
||
|
[ '/foo/bar/index.js', '/', 'foo/bar/', 'index.js', '.js' ]
|
||
|
> parts = RE.exec( './foo/bar/.gitignore' ).slice()
|
||
|
[ './foo/bar/.gitignore', '', './foo/bar/', '.gitignore', '' ]
|
||
|
> parts = RE.exec( 'foo/file.pdf' ).slice()
|
||
|
[ 'foo/file.pdf', '', 'foo/', 'file.pdf', '.pdf' ]
|
||
|
> parts = RE.exec( '/foo/bar/file' ).slice()
|
||
|
[ '/foo/bar/file', '/', 'foo/bar/', 'file', '' ]
|
||
|
> parts = RE.exec( 'index.js' ).slice()
|
||
|
[ 'index.js', '', '', 'index.js', '.js' ]
|
||
|
> parts = RE.exec( '.' ).slice()
|
||
|
[ '.', '', '', '.', '' ]
|
||
|
> parts = RE.exec( './' ).slice()
|
||
|
[ './', '', ..., '.', '' ]
|
||
|
> parts = RE.exec( '' ).slice()
|
||
|
[ '', '', '', '', '' ]
|
||
|
|
||
|
|
||
|
{{alias}}.REGEXP
|
||
|
Regular expression to split a POSIX filename.
|
||
|
|
||
|
Examples
|
||
|
--------
|
||
|
> var parts = {{alias}}.REGEXP.exec( '/foo/bar/index.js' ).slice()
|
||
|
[ '/foo/bar/index.js', '/', 'foo/bar/', 'index.js', '.js' ]
|
||
|
|
||
|
See Also
|
||
|
--------
|
||
|
|