diff --git a/lib/helpers.js b/lib/helpers.js index b5f7342..53eb715 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -388,7 +388,9 @@ function parse(data, regex) { } const options = assign({ flags: '' }, opts); - options.flags += 'g'; + if (options.flags.indexOf('g') === -1) { + options.flags += 'g'; + } const messages = []; const compiledRegexp = NamedRegexp(regex, options.flags); diff --git a/src/helpers.js b/src/helpers.js index be6e2ae..21ad5a0 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -332,7 +332,9 @@ export function parse(data, regex, opts = {}) { } const options = assign({flags: ''}, opts) - options.flags += 'g' + if (options.flags.indexOf('g') === -1) { + options.flags += 'g' + } const messages = [] const compiledRegexp = NamedRegexp(regex, options.flags)