Merge pull request #7934 from influxdata/jl-regex-case#7906
regex: don't use exact match for case insensitive expressionpull/7937/head
commit
b0abd6a23b
|
@ -6,6 +6,7 @@
|
||||||
- [#7888](https://github.com/influxdata/influxdb/pull/7888): Expand query dimensions from the subquery.
|
- [#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.
|
- [#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)
|
- [#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]
|
## v1.2.0 [2017-01-24]
|
||||||
|
|
||||||
|
|
|
@ -5542,6 +5542,12 @@ func TestServer_Query_With_EmptyTags(t *testing.T) {
|
||||||
command: `select value from cpu where host =~ /^server01$/`,
|
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]]}]}]}`,
|
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{
|
&Query{
|
||||||
name: "where regex exact (not)",
|
name: "where regex exact (not)",
|
||||||
params: url.Values{"db": []string{"db0"}},
|
params: url.Values{"db": []string{"db0"}},
|
||||||
|
|
|
@ -1369,7 +1369,7 @@ func matchExactRegex(v string) (string, bool) {
|
||||||
|
|
||||||
if len(re.Sub) == 3 {
|
if len(re.Sub) == 3 {
|
||||||
middle := re.Sub[1]
|
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.
|
// Regex does not contain a literal op.
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue