Update JSON API
[src/app-framework-demo.git] / afm-client / bower_components / jszip / documentation / api_jszip / folder_regex.md
1 ---
2 title: "folder(regex)"
3 layout: default
4 section: api
5 ---
6
7 __Description__ : Search a subdirectory in the current directory with a
8 [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions).
9 The regex is tested against the relative path.
10
11 __Arguments__
12
13 name  | type   | description
14 ------|--------|------------
15 regex | RegExp | the regex to use.
16
17 __Returns__ : An array of matching folders (an empty array if none matched).
18 Each maching folder is an instance of [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html).
19
20 __Throws__ : Nothing.
21
22 <!--
23 __Complexity__ : **O(k)** where k is the number of entries in the current JSZip
24 instance.
25 -->
26
27 __Example__
28
29 ```js
30 var zip = new JSZip();
31 zip.folder("home/Pierre/videos");
32 zip.folder("home/Pierre/photos");
33 zip.folder("home/Jean/videos");
34 zip.folder("home/Jean/photos");
35
36 zip.folder(/videos/); // array of size 2
37
38 zip.folder("home/Jean").folder(/^vid/); // array of 1
39 ```
40