repl.txt (1328B)
1 2 {{alias}}( [platform] ) 3 Returns a regular expression to capture the last part of a path. 4 5 The regular expression is platform-dependent. If the current process is 6 running on Windows, the regular expression is `*.REGEXP_WIN32`; otherwise, 7 `*.REGEXP_POSIX`. 8 9 Parameters 10 ---------- 11 platform: string (optional) 12 Path platform (either `posix` or `win32`). 13 14 Returns 15 ------- 16 re: RegExp 17 Regular expression. 18 19 Examples 20 -------- 21 > var RE = {{alias}}() 22 <RegExp> 23 > var RE_POSIX = {{alias}}( 'posix' ); 24 > var RE_WIN32 = {{alias}}( 'win32' ); 25 > var str = RE.toString(); 26 > var bool = ( str === RE_POSIX.toString() || str === RE_WIN32.toString() ) 27 true 28 29 30 {{alias}}.REGEXP 31 Regular expression to capture the last part of a POSIX path. 32 33 Examples 34 -------- 35 > var RE = {{alias}}.REGEXP 36 <RegExp> 37 38 39 {{alias}}.REGEXP_POSIX 40 Regular expression to capture the last part of a POSIX path. 41 42 Examples 43 -------- 44 > var base = {{alias}}.REGEXP_POSIX.exec( '/foo/bar/index.js' )[ 1 ] 45 'index.js' 46 47 48 {{alias}}.REGEXP_WIN32 49 Regular expression to capture the last part of a Windows path. 50 51 Examples 52 -------- 53 > var base = {{alias}}.REGEXP_WIN32.exec( 'C:\\foo\\bar\\index.js' )[ 1 ] 54 'index.js' 55 56 See Also 57 -------- 58