diff --git a/public/app/features/templating/custom_variable.ts b/public/app/features/templating/custom_variable.ts index bc946458705..c98048f04ca 100644 --- a/public/app/features/templating/custom_variable.ts +++ b/public/app/features/templating/custom_variable.ts @@ -38,8 +38,9 @@ export class CustomVariable implements Variable { } updateOptions() { - // extract options in comma separated string - this.options = _.map(this.query.split(/[,]+/), text => { + // extract options in comma separated string (use backslash to escape wanted commas) + this.options = _.map(this.query.match(/(?:\\,|[^,])+/g), text => { + text = text.replace('\\,', ','); return { text: text.trim(), value: text.trim() }; }); diff --git a/public/app/features/templating/partials/editor.html b/public/app/features/templating/partials/editor.html index 15984eba7d6..78733b3b2be 100644 --- a/public/app/features/templating/partials/editor.html +++ b/public/app/features/templating/partials/editor.html @@ -151,7 +151,7 @@