54 lines
1.6 KiB
Plaintext
54 lines
1.6 KiB
Plaintext
|
|
{{alias}}()
|
|
Returns a regular expression to split a Windows filename.
|
|
|
|
When executed, the regular expression splits a Windows filename into the
|
|
following parts:
|
|
|
|
- input value
|
|
- device
|
|
- slash
|
|
- 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( 'C:\\foo\\bar\\index.js' ).slice()
|
|
[ 'C:\\foo\\bar\\index.js', 'C:', '\\', '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 Windows filename.
|
|
|
|
Examples
|
|
--------
|
|
> var parts = {{alias}}.REGEXP.exec( 'C:\\foo\\bar\\index.js' ).slice()
|
|
[ 'C:\\foo\\bar\\index.js', 'C:', '\\', 'foo\\bar\\', 'index.js', '.js' ]
|
|
|
|
See Also
|
|
--------
|