Box.Pattern Class
Description
The pattern object of the Box class.
This module parses the string and tests if the string matches the pattern.
You can use a regular expression, a function or a Backbone-like string in the rule
param.
Constructor
Box.Pattern
(rule)Methods
match
(str) ObjectTests if the string matches the pattern and returns the parameters in the URL. Returns null
if the string doesn’t matches the pattern.
For example:
// posts/:idpattern.match('posts/89')// {0: 'posts/89', 1: '89', id: '89'}// posts/*pathpattern.match('posts/2013/hello-world')// {0: 'posts/2013/hello-world', 1: '2013/hello-world', path: '2013/hello-world'}
Parameters
- str String