time-to-botec/squiggle/node_modules/@stdlib/regexp/filename-windows/docs/repl.txt

54 lines
1.6 KiB
Plaintext
Raw Normal View History

{{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
--------