atuttle/Taffy — pull request #225 by danshort (2014-09-03 13:34:06+00:00)
Title: Dashboard regex tokens not matched

When using the following taff:uri, the dashboard did not correctly replace the tokens in the sample resource URI:

taffy_uri="/member/{id:\d+}"

I adjusted the supplant prototype function to match all characters within the `{}`. I had to play some tricks with it to ensure that it could catch matches within `/`s and at the end of a string.

{ //Start with a curly brace for the match
(.*?) //Match as few characters untili the next match
( //Start a new grouping
}(?=\/) //Catch a curly brace immediately followed by a /
| // OR
}$ //A curly brace at the end of the string
) //End the group

Will now match all items in the following resource uri:

/member/{id}/county/{type}/{foo:\d+}/{foo:\d{2}}