Commit 2f458f6 1 parent 9b4625c commit 2f458f6 Copy full SHA for 2f458f6
File tree 3 files changed +33
-3
lines changed
3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change 1
1
package metadata
2
2
3
3
remap : expressions : comparison : {
4
- title : " Comparison "
4
+ title : " Comparison "
5
5
description : """
6
6
A _comparison_ expression compares two expressions (operands) and produces a Boolean as defined by the
7
- operator.
7
+ operator. Please refer to the [match function](\( urls . vrl_match_function )) for matching a string against a regex.
8
8
"""
9
9
return : """
10
10
Returns a Boolean as defined by the operator.
@@ -39,19 +39,41 @@ remap: expressions: comparison: {
39
39
40
40
examples : [
41
41
{
42
- title : " Equal "
42
+ title : " Equal integers "
43
43
source : #"""
44
44
1 == 1
45
45
"""#
46
46
return : true
47
47
},
48
+ {
49
+ title : " Equal integer and float "
50
+ source : #"""
51
+ 1 == 1.0
52
+ """#
53
+ return : true
54
+ },
48
55
{
49
56
title : " Not equal "
50
57
source : #"""
51
58
1 != 2
52
59
"""#
53
60
return : true
54
61
},
62
+ {
63
+ title : " Equal string "
64
+ source : #"""
65
+ x = "foo"
66
+ x == "foo"
67
+ """#
68
+ return : true
69
+ },
70
+ {
71
+ title : " Not equal strings "
72
+ source : #"""
73
+ "foo" != "bar"
74
+ """#
75
+ return : true
76
+ },
55
77
{
56
78
title : " Greater than or equal "
57
79
source : #"""
Original file line number Diff line number Diff line change @@ -31,5 +31,12 @@ remap: functions: match: {
31
31
"""
32
32
return : true
33
33
},
34
+ {
35
+ title : " String does not match the regular expression "
36
+ source : """
37
+ match("I'm a little teapot", r'.*balloon')
38
+ """
39
+ return : false
40
+ },
34
41
]
35
42
}
Original file line number Diff line number Diff line change @@ -635,6 +635,7 @@ urls: {
635
635
vrl_features : " \(vrl_reference )/#features "
636
636
vrl_functions : " \(vrl_reference )/functions "
637
637
vrl_literals : " \(vrl_expressions )/#literal-expressions "
638
+ vrl_match_function : " \(vrl_functions )/#match "
638
639
vrl_parsing_functions : " \(vrl_functions )/#parse-functions "
639
640
vrl_path_expressions : " \(vrl_expressions )#path "
640
641
vrl_performance : " \(vrl_reference )#performance "
You can’t perform that action at this time.
0 commit comments