Skip to content

Commit 33dc417

Browse files
authored
[DOCS] EQL: Document wildcard function (#54086)
1 parent e67eab6 commit 33dc417

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

docs/reference/eql/functions.asciidoc

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ experimental::[]
1313
* <<eql-fn-length>>
1414
* <<eql-fn-startswith>>
1515
* <<eql-fn-substring>>
16+
* <<eql-fn-wildcard>>
1617

1718
[discrete]
1819
[[eql-fn-between]]
@@ -389,4 +390,70 @@ function returns the remaining string.
389390
Positions are zero-indexed. Negative offsets are supported.
390391
391392
*Returns:* string
393+
====
394+
395+
[discrete]
396+
[[eql-fn-wildcard]]
397+
=== `wildcard`
398+
Returns `true` if a source string matches one or more provided wildcard
399+
expressions.
400+
401+
[%collapsible]
402+
====
403+
*Example*
404+
[source,eql]
405+
----
406+
// The two following expressions are equivalent.
407+
process.name == "*regsvr32*" or process.name == "*explorer*"
408+
wildcard(process.name, "*regsvr32*", "*explorer*")
409+
410+
// process.name = "regsvr32.exe"
411+
wildcard(process.name, "*regsvr32*") // returns true
412+
wildcard(process.name, "*regsvr32*", "*explorer*") // returns true
413+
wildcard(process.name, "*explorer*") // returns false
414+
wildcard(process.name, "*explorer*", "*scrobj*") // returns false
415+
416+
// empty strings
417+
wildcard("", "*start*") // returns false
418+
wildcard("", "*") // returns true
419+
wildcard("", "") // returns true
420+
421+
// null handling
422+
wildcard(null, "*regsvr32*") // returns null
423+
wildcard(process.name, null) // returns null
424+
----
425+
426+
*Syntax*
427+
428+
[source,txt]
429+
----
430+
wildcard(<source>, <wildcard_exp>[, ...])
431+
----
432+
433+
*Parameters*
434+
435+
`<source>`::
436+
+
437+
--
438+
(Required, string)
439+
Source string. If `null`, the function returns `null`.
440+
441+
If using a field as the argument, this parameter only supports the following
442+
field datatypes:
443+
444+
* <<keyword,`keyword`>>
445+
* <<constant-keyword,`constant_keyword`>>
446+
* <<text,`text`>> field with a <<keyword,`keyword`>> or
447+
<<constant-keyword,`constant_keyword`>> sub-field
448+
--
449+
450+
`<wildcard_exp>`::
451+
+
452+
--
453+
(Required{multi-arg}, string)
454+
Wildcard expression used to match the source string. If `null`, the function
455+
returns `null`. Fields are not supported as arguments.
456+
--
457+
458+
*Returns:* boolean
392459
====

0 commit comments

Comments
 (0)