Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (23 sloc) 0.989 kb
4bd8cdf @laktek Added README and package.json
authored
1 ## ExtractValues
2
3 This is a simple helper to extract values from a string based on a pattern.
4
5 ### Examples
6
7 ```javascript
8
9 extractValues("/2012/08/12/test.html", "/{year}/{month}/{day}/{title}.html")
10 >> { "year": "2012", "month": "08", "day": "12", "title": "test" }
11
12 extractValues("John Doe <john@example.com> (http://example.com)", "{name} <{email}> ({url})")
13 >> {"name": "John Doe", "email": "john@example.com", "url": "http://example.com" }
14
7bf0bb6 @laktek Updated the examples
authored
15 extractValues("from 4th October to 10th October", "from `from` to `to`", { whitespace: 1, delimeters: ["`", "`"] })
16 >> {"from": "4th October", "to": "10th October" }
4bd8cdf @laktek Added README and package.json
authored
17 ```
18
19 ### How to Use
20
21 * Install as a NPM package
22
23 ```
24 npm install extract-values
25 ```
26
27 * Then `require` in your project.
28
29 ```javascript
30 var extractValues = require("extractValues");
31 ```
32
33 * For client-side use, simply copy and paste the function (`extract_values.js`) in to your source.
34
35 ### Licence
36
37 [MIT LICENSE](https://github.com/laktek/punch/blob/master/LICENSE)
Something went wrong with that request. Please try again.