Implemented URL query parsing for initial token /opa/?token=abcde
[src/app-framework-demo.git] / afb-client / bower_components / jszip / documentation / api_jszip / file_regex.md
1 ---
2 title: "file(regex)"
3 layout: default
4 section: api
5 ---
6
7 __Description__ : Search a file in the current folder and subfolders 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 filename.
10
11 __Arguments__
12
13 name  | type   | description
14 ------|--------|------------
15 regex | RegExp | the regex to use.
16
17 __Returns__ : An array of matching files (an empty array if none matched). Each
18 maching file 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.file("file1.txt", "content");
32 zip.file("file2.txt", "content");
33
34 zip.file(/file/); // array of size 2
35
36 // example with a relative path :
37 var folder = zip.folder("sub");
38 folder
39   .file("file3.txt", "content")  // relative path from folder : file3.txt
40   .file("file4.txt", "content"); // relative path from folder : file4.txt
41
42 folder.file(/file/);  // array of size 2
43 folder.file(/^file/); // array of size 2, the relative paths start with file
44
45 // arrays contain objects in the form:
46 // {name: "file2.txt", dir: false, asText : function () {...}, ...}
47 ```
48
49