@ -142,8 +142,8 @@ function addLabelsToExpression(expr: string, invalidLabelsRegexp: RegExp) {
// Split query into 2 parts - before the invalidLabelsRegex match and after.
// Split query into 2 parts - before the invalidLabelsRegex match and after.
const indexOfRegexMatch = match . index ? ? 0 ;
const indexOfRegexMatch = match . index ? ? 0 ;
const exprBeforeRegexMatch = expr . substr ( 0 , indexOfRegexMatch + 1 ) ;
const exprBeforeRegexMatch = expr . slice ( 0 , indexOfRegexMatch + 1 ) ;
const exprAfterRegexMatch = expr . substr ( indexOfRegexMatch + 1 ) ;
const exprAfterRegexMatch = expr . slice ( indexOfRegexMatch + 1 ) ;
// Create arrayOfLabelObjects with label objects that have key, operator and value.
// Create arrayOfLabelObjects with label objects that have key, operator and value.
const arrayOfLabelObjects : Array < { key : string ; operator : string ; value : string } > = [ ] ;
const arrayOfLabelObjects : Array < { key : string ; operator : string ; value : string } > = [ ] ;
@ -157,7 +157,7 @@ function addLabelsToExpression(expr: string, invalidLabelsRegexp: RegExp) {
let result = exprBeforeRegexMatch ;
let result = exprBeforeRegexMatch ;
arrayOfLabelObjects . filter ( Boolean ) . forEach ( ( obj ) = > {
arrayOfLabelObjects . filter ( Boolean ) . forEach ( ( obj ) = > {
// Remove extra set of quotes from obj.value
// Remove extra set of quotes from obj.value
const value = obj . value . substr ( 1 , obj . value . length - 2 ) ;
const value = obj . value . slice ( 1 , - 1 ) ;
result = addLabelToQuery ( result , obj . key , value , obj . operator ) ;
result = addLabelToQuery ( result , obj . key , value , obj . operator ) ;
} ) ;
} ) ;