time-to-botec/js/node_modules/@stdlib/regexp/filename-posix/docs/repl.txt
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

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