Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions website/cue/reference/remap/expressions/comparison.cue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package metadata

remap: expressions: comparison: {
title: "Comparison"
title: "Comparison"
description: """
A _comparison_ expression compares two expressions (operands) and produces a Boolean as defined by the
operator.
operator. Please refer to the [match function](\(urls.vrl_match_function)) for matching a string against a regex.
"""
return: """
Returns a Boolean as defined by the operator.
Expand Down Expand Up @@ -39,19 +39,41 @@ remap: expressions: comparison: {

examples: [
{
title: "Equal"
title: "Equal integers"
source: #"""
1 == 1
"""#
return: true
},
{
title: "Equal integer and float"
source: #"""
1 == 1.0
"""#
return: true
},
{
title: "Not equal"
source: #"""
1 != 2
"""#
return: true
},
{
title: "Equal string"
source: #"""
x = "foo"
x == "foo"
"""#
return: true
},
{
title: "Not equal strings"
source: #"""
"foo" != "bar"
"""#
return: true
},
{
title: "Greater than or equal"
source: #"""
Expand Down
7 changes: 7 additions & 0 deletions website/cue/reference/remap/functions/match.cue
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,12 @@ remap: functions: match: {
"""
return: true
},
{
title: "String does not match the regular expression"
source: """
match("I'm a little teapot", r'.*balloon')
"""
return: false
},
]
}
1 change: 1 addition & 0 deletions website/cue/reference/urls.cue
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ urls: {
vrl_features: "\(vrl_reference)/#features"
vrl_functions: "\(vrl_reference)/functions"
vrl_literals: "\(vrl_expressions)/#literal-expressions"
vrl_match_function: "\(vrl_functions)/#match"
vrl_parsing_functions: "\(vrl_functions)/#parse-functions"
vrl_path_expressions: "\(vrl_expressions)#path"
vrl_performance: "\(vrl_reference)#performance"
Expand Down