63 lines
1.4 KiB
Plaintext
63 lines
1.4 KiB
Plaintext
|
|
||
|
{{alias}}( [platform] )
|
||
|
Returns a regular expression to capture a path dirname.
|
||
|
|
||
|
The regular expression is platform-dependent. If the current process is
|
||
|
running on Windows, the regular expression is `*.REGEXP_WIN32`; otherwise,
|
||
|
`*.REGEXP_POSIX`.
|
||
|
|
||
|
Parameters
|
||
|
----------
|
||
|
platform: string (optional)
|
||
|
Path platform (either `posix` or `win32`).
|
||
|
|
||
|
Returns
|
||
|
-------
|
||
|
re: RegExp
|
||
|
Regular expression.
|
||
|
|
||
|
Examples
|
||
|
--------
|
||
|
> var RE = {{alias}}()
|
||
|
<RegExp>
|
||
|
> var RE_POSIX = {{alias}}( 'posix' );
|
||
|
> var dir = RE_POSIX.exec( '/foo/bar/index.js' )[ 1 ]
|
||
|
'/foo/bar'
|
||
|
> var RE_WIN32 = {{alias}}( 'win32' );
|
||
|
> dir = RE_WIN32.exec( 'C:\\foo\\bar\\index.js' )[ 1 ]
|
||
|
'C:\\foo\\bar'
|
||
|
> var str = RE.toString();
|
||
|
> var bool = ( str === RE_POSIX.toString() || str === RE_WIN32.toString() )
|
||
|
true
|
||
|
|
||
|
|
||
|
{{alias}}.REGEXP
|
||
|
Regular expression to capture a path dirname.
|
||
|
|
||
|
Examples
|
||
|
--------
|
||
|
> var RE = {{alias}}.REGEXP
|
||
|
<RegExp>
|
||
|
|
||
|
|
||
|
{{alias}}.REGEXP_POSIX
|
||
|
Regular expression to capture a POSIX path dirname.
|
||
|
|
||
|
Examples
|
||
|
--------
|
||
|
> var dir = {{alias}}.REGEXP_POSIX.exec( '/foo/bar/index.js' )[ 1 ]
|
||
|
'/foo/bar'
|
||
|
|
||
|
|
||
|
{{alias}}.REGEXP_WIN32
|
||
|
Regular expression to capture a Windows path dirname.
|
||
|
|
||
|
Examples
|
||
|
--------
|
||
|
> var dir = {{alias}}.REGEXP_WIN32.exec( 'C:\\foo\\bar\\index.js' )[ 1 ]
|
||
|
'C:\\foo\\bar'
|
||
|
|
||
|
See Also
|
||
|
--------
|
||
|
|