Added support for named groups when using regex pattern

This commit is contained in:
Corey Butler
2020-09-10 18:27:44 -05:00
parent 99d46556b4
commit 55e6626289
2 changed files with 11 additions and 0 deletions

View File

@ -19,6 +19,8 @@ export default class Regex {
if (!content) {
this._version = null
// throw new Error(`Could not find pattern matching "${pattern.toString()}" in "${root}".`)
} else if (content.groups && content.groups.version) {
this._version = content.groups.version
} else {
this._version = content[1]
}