Преглед изворни кода

used regex instead of string replacing

sridhar-komati пре 6 година
родитељ
комит
03d4b61208
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      public/app/features/templating/custom_variable.ts

+ 1 - 1
public/app/features/templating/custom_variable.ts

@@ -40,7 +40,7 @@ export class CustomVariable implements Variable {
   updateOptions() {
   updateOptions() {
     // extract options in comma separated string (use backslash to escape wanted commas)
     // extract options in comma separated string (use backslash to escape wanted commas)
     this.options = _.map(this.query.match(/(?:\\,|[^,])+/g), text => {
     this.options = _.map(this.query.match(/(?:\\,|[^,])+/g), text => {
-      text = text.replace('\\,', ',');
+      text = text.replace(/\\,/g, ',');
       return { text: text.trim(), value: text.trim() };
       return { text: text.trim(), value: text.trim() };
     });
     });