<commit_before># dirname

> [Regular expression][regexp] to capture a path [dirname][dirname].


<section class="usage">

## Usage

``` javascript
var RE_DIRNAME = require( '@stdlib/regexp/dirname' );
```

#### RE_DIRNAME

[Regular expression][regexp] to capture a path [dirname][dirname]. 

``` javascript
var dir;

// On a POSIX platform...
dir = RE_DIRNAME.exec( '/foo/bar/index.js' )[ 1 ];
// returns '/foo/bar'

// On a Windows platform...
dir = RE_DIRNAME.exec( 'C:\\foo\\bar\\index.js' )[ 1 ];
// returns 'C:\\foo\\bar'
```


#### RE_DIRNAME.posix

[Regular expression][@stdlib/regexp/dirname-posix] to capture a [POSIX][posix] path dirname.


#### RE_DIRNAME.win32

[Regular expression][@stdlib/regexp/dirname-windows] to capture a Windows path dirname.

</section>

<!-- /.usage -->


<section class="notes">

## Notes

* The main exported [regular expression][regexp] is [platform][@stdlib/utils/is-windows]-dependent. If the current process is running on Windows, `re === re.win32`; otherwise, `re === re.posix`.

</section>

<!-- /.notes -->


<section class="examples">

## Examples

``` javascript
var RE_DIRNAME = require( '@stdlib/regexp/dirname' );

var dir;

// Assuming a POSIX platform...
dir = RE_DIRNAME.exec( '/foo/bar/index.js' )[ 1 ];
// returns '/foo/bar'

dir = RE_DIRNAME.posix.exec( '/foo/bar/home.html' )[ 1 ];
// returns '/foo/bar'

dir = RE_DIRNAME.win32.exec( 'C:\\foo\\bar\\home.html' )[ 1 ];
// returns 'C:\\foo\\bar'
```

</section>

<!-- /.examples -->


<section class="links">

[regexp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
[dirname]: https://en.wikipedia.org/wiki/Dirname
[posix]: https://en.wikipedia.org/wiki/POSIX
[@stdlib/utils/is-windows]: https://github.com/stdlib-js/stdlib
[@stdlib/regexp/dirname-posix]: https://github.com/stdlib-js/stdlib
[@stdlib/regexp/dirname-windows]: https://github.com/stdlib-js/stdlib

</section>

<!-- /.links -->
<commit_msg>Create separate examples<commit_after># dirname

> [Regular expression][regexp] to capture a path [dirname][dirname].


<section class="usage">

## Usage

``` javascript
var RE_DIRNAME = require( '@stdlib/regexp/dirname' );
```

#### RE_DIRNAME

[Regular expression][regexp] to capture a path [dirname][dirname].


#### RE_DIRNAME.posix

[Regular expression][@stdlib/regexp/dirname-posix] to capture a [POSIX][posix] path dirname. 

``` javascript
var dir = RE_DIRNAME.posix.exec( '/foo/bar/index.js' )[ 1 ];
// returns '/foo/bar'
```


#### RE_DIRNAME.win32

[Regular expression][@stdlib/regexp/dirname-windows] to capture a Windows path dirname. 

``` javascript
var dir = RE_DIRNAME.win32.exec( 'C:\\foo\\bar\\index.js' )[ 1 ];
// returns 'C:\\foo\\bar'
```

</section>

<!-- /.usage -->


<section class="notes">

## Notes

* The main exported [regular expression][regexp] is [platform][@stdlib/utils/is-windows]-dependent. If the current process is running on Windows, `re === re.win32`; otherwise, `re === re.posix`.

</section>

<!-- /.notes -->


<section class="examples">

## Examples

``` javascript
var RE_DIRNAME = require( '@stdlib/regexp/dirname' );

var dir;

// Assuming a POSIX platform...
dir = RE_DIRNAME.exec( '/foo/bar/index.js' )[ 1 ];
// returns '/foo/bar'

dir = RE_DIRNAME.posix.exec( '/foo/bar/home.html' )[ 1 ];
// returns '/foo/bar'

dir = RE_DIRNAME.win32.exec( 'C:\\foo\\bar\\home.html' )[ 1 ];
// returns 'C:\\foo\\bar'
```

</section>

<!-- /.examples -->


<section class="links">

[regexp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
[dirname]: https://en.wikipedia.org/wiki/Dirname
[posix]: https://en.wikipedia.org/wiki/POSIX
[@stdlib/utils/is-windows]: https://github.com/stdlib-js/stdlib
[@stdlib/regexp/dirname-posix]: https://github.com/stdlib-js/stdlib
[@stdlib/regexp/dirname-windows]: https://github.com/stdlib-js/stdlib

</section>

<!-- /.links -->

{'fraction_non_alphanumeric': 0.20793609894357123, 'fraction_numerical': 0.006183973202782788, 'mean_word_length': 3.828358208955224, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7052612', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1333, 'n_words': 281}