cloudhead / cloudhead/journey

Matched route returns wrong value for capture group

Open
#28 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
322
Forks
26
PR merge metrics
No merged PRs in 30d

Description

I have a regex route containing the capture group `(.+)` (matching everything).
This works as expected most of the time and I can access the matched group in the third argument of bind´s callback function. However, numeric values are somehow modified. `01` becomes `1`… alright. But: `053` becomes `43`. And `0123` becomes `83`.

My Code is:

``` javascript
router.get(/^search\/(.+)?$/).bind(function(req, res, val){
console.log("req.url.path: "+req.url.path)
console.log("captured: "+val);
});
```

And the output is:

```
req.url.path: /search/0123
captured: 83
```

It's not a Javascript issue, if I match the path using the regex.exec function, the capture group is correct.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.