Skip to content

Conversation

@fskreuz
Copy link

@fskreuz fskreuz commented Dec 29, 2015

Problem:

var sourceMapRegExp = new RegExp(/(?:\/\/#|\/\/@|\/\*#)\s*sourceMappingURL=(.*)\s*(?:\*\/\s*)?$/);
var match = '/*# sourceMappingURL=bootstrap.css.map */'.match(sourceMapRegExp);

// ["/*# sourceMappingURL=bootstrap.css.map */", "bootstrap.css.map */"]

match[1] contains the trailing */

Solution:

Make the capture for the path non-greedy.

**Problem:**

```
var sourceMapRegExp = new RegExp(/(?:\/\/#|\/\/@|\/\*#)\s*sourceMappingURL=(.*)\s*(?:\*\/\s*)?$/);
var match = '/*# sourceMappingURL=bootstrap.css.map */'.match(sourceMapRegExp);

// ["/*# sourceMappingURL=bootstrap.css.map */", "bootstrap.css.map */"]
```

`match[1]` contains the trailing ` */`

**Solution:**

Make the capture for the path non-greedy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant