diff --git a/public/app/plugins/datasource/influxdb/datasource.test.ts b/public/app/plugins/datasource/influxdb/datasource.test.ts index 284717ac701..b2cdd4522e3 100644 --- a/public/app/plugins/datasource/influxdb/datasource.test.ts +++ b/public/app/plugins/datasource/influxdb/datasource.test.ts @@ -363,18 +363,6 @@ describe('interpolateQueryExpr', () => { expect(result).toBe(expectation); }); - it('should **not** return the escaped value if the value **is not** wrapped in regex and the query is more complex (e.g. text is contained between two / but not a regex', () => { - const value = 'testmatch'; - const variableMock = queryBuilder().withId('tempVar').withName('tempVar').withMulti(false).build(); - const result = ds.interpolateQueryExpr( - value, - variableMock, - `select value where ("tag"::tag =~ /value/) AND where other = $tempVar $timeFilter GROUP BY time($__interval) tz('Europe/London')` - ); - const expectation = `testmatch`; - expect(result).toBe(expectation); - }); - it('should return floating point number as it is', () => { const variableMock = queryBuilder() .withId('tempVar') diff --git a/public/app/plugins/datasource/influxdb/datasource.ts b/public/app/plugins/datasource/influxdb/datasource.ts index a0be6d90bf3..1292ac4b625 100644 --- a/public/app/plugins/datasource/influxdb/datasource.ts +++ b/public/app/plugins/datasource/influxdb/datasource.ts @@ -351,30 +351,17 @@ export default class InfluxDatasource extends DataSourceWithBackend escapeRegex(v)).join('|')})`; + return `(${value.map((v) => escapeRegex(v)).join('|')})`; } return value;