time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1511B)


      1 
      2 {{alias}}()
      3     Returns a regular expression to split a POSIX filename.
      4 
      5     When executed, the regular expression splits a POSIX filename into the
      6     following parts:
      7 
      8     - input value
      9     - root
     10     - dirname
     11     - basename
     12     - extname
     13 
     14     When executed against dotfile filenames (e.g., `.gitignore`), the regular
     15     expression does not capture the basename as a filename extension.
     16 
     17     Returns
     18     -------
     19     re: RegExp
     20         Regular expression.
     21 
     22     Examples
     23     --------
     24     > var RE = {{alias}}();
     25     > var parts = RE.exec( '/foo/bar/index.js' ).slice()
     26     [ '/foo/bar/index.js', '/', 'foo/bar/', 'index.js', '.js' ]
     27     > parts = RE.exec( './foo/bar/.gitignore' ).slice()
     28     [ './foo/bar/.gitignore', '', './foo/bar/', '.gitignore', '' ]
     29     > parts = RE.exec( 'foo/file.pdf' ).slice()
     30     [ 'foo/file.pdf', '', 'foo/', 'file.pdf', '.pdf' ]
     31     > parts = RE.exec( '/foo/bar/file' ).slice()
     32     [ '/foo/bar/file', '/', 'foo/bar/', 'file', '' ]
     33     > parts = RE.exec( 'index.js' ).slice()
     34     [ 'index.js', '', '', 'index.js', '.js' ]
     35     > parts = RE.exec( '.' ).slice()
     36     [ '.', '', '', '.', '' ]
     37     > parts = RE.exec( './' ).slice()
     38     [ './', '', ..., '.', '' ]
     39     > parts = RE.exec( '' ).slice()
     40     [ '', '', '', '', '' ]
     41 
     42 
     43 {{alias}}.REGEXP
     44     Regular expression to split a POSIX filename.
     45 
     46     Examples
     47     --------
     48     > var parts = {{alias}}.REGEXP.exec( '/foo/bar/index.js' ).slice()
     49     [ '/foo/bar/index.js', '/', 'foo/bar/', 'index.js', '.js' ]
     50 
     51     See Also
     52     --------
     53