regex: don't use exact match for case insensitive expression
pull/7937/head
joelegasse 2017-02-02 10:53:35 -05:00 committed by GitHub
commit b0abd6a23b
3 changed files with 8 additions and 1 deletions

View File

@ -6,6 +6,7 @@
- [#7888](https://github.com/influxdata/influxdb/pull/7888): Expand query dimensions from the subquery.
- [#7910](https://github.com/influxdata/influxdb/issues/7910): Fix EvalType when a parenthesis expression is used.
- [#7929](https://github.com/influxdata/influxdb/issues/7929): Fix series tag iteration segfault. (#7922)
- [#7906](https://github.com/influxdata/influxdb/issues/7906): Anchors not working as expected with case-insensitive regex
## v1.2.0 [2017-01-24]

View File

@ -5542,6 +5542,12 @@ func TestServer_Query_With_EmptyTags(t *testing.T) {
command: `select value from cpu where host =~ /^server01$/`,
exp: `{"results":[{"statement_id":0,"series":[{"name":"cpu","columns":["time","value"],"values":[["2009-11-10T23:00:03Z",2]]}]}]}`,
},
&Query{
name: "where regex exact (case insensitive)",
params: url.Values{"db": []string{"db0"}},
command: `select value from cpu where host =~ /(?i)^SeRvEr01$/`,
exp: `{"results":[{"statement_id":0,"series":[{"name":"cpu","columns":["time","value"],"values":[["2009-11-10T23:00:03Z",2]]}]}]}`,
},
&Query{
name: "where regex exact (not)",
params: url.Values{"db": []string{"db0"}},

View File

@ -1369,7 +1369,7 @@ func matchExactRegex(v string) (string, bool) {
if len(re.Sub) == 3 {
middle := re.Sub[1]
if middle.Op != syntax.OpLiteral {
if middle.Op != syntax.OpLiteral || middle.Flags^syntax.Perl != 0 {
// Regex does not contain a literal op.
return "", false
}