Skip to content

Commit 5981412

Browse files
authored
[DOCS] EQL: Document stringContains function (#54968)
1 parent b0e8a8a commit 5981412

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

docs/reference/eql/functions.asciidoc

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ experimental::[]
1515
* <<eql-fn-length>>
1616
* <<eql-fn-startswith>>
1717
* <<eql-fn-string>>
18+
* <<eql-fn-stringcontains>>
1819
* <<eql-fn-substring>>
1920
* <<eql-fn-wildcard>>
2021

@@ -532,6 +533,68 @@ If using a field as the argument, this parameter does not support the
532533
*Returns:* string or `null`
533534
====
534535

536+
[discrete]
537+
[[eql-fn-stringcontains]]
538+
=== `stringContains`
539+
540+
Returns `true` if a source string contains a provided substring.
541+
542+
[%collapsible]
543+
====
544+
*Example*
545+
[source,eql]
546+
----
547+
// process.command_line = "start regsvr32.exe"
548+
stringContains(process.command_line, "regsvr32") // returns true
549+
stringContains(process.command_line, "start ") // returns true
550+
stringContains(process.command_line, "explorer") // returns false
551+
552+
// process.name = "regsvr32.exe"
553+
stringContains(command_line, process.name) // returns true
554+
555+
// empty strings
556+
stringContains("", "") // returns false
557+
stringContains(process.command_line, "") // returns false
558+
559+
// null handling
560+
stringContains(null, "regsvr32") // returns null
561+
stringContains(process.command_line, null) // returns null
562+
----
563+
564+
*Syntax*
565+
[source,txt]
566+
----
567+
stringContains(<source>, <substring>)
568+
----
569+
570+
*Parameters*
571+
`<source>`::
572+
(Required, string or `null`)
573+
Source string to search. If `null`, the function returns `null`.
574+
575+
If using a field as the argument, this parameter supports only the following
576+
field datatypes:
577+
578+
* <<keyword,`keyword`>>
579+
* <<constant-keyword,`constant_keyword`>>
580+
* <<text,`text`>> field with a <<keyword,`keyword`>> or
581+
<<constant-keyword,`constant_keyword`>> sub-field
582+
583+
`<substring>`::
584+
(Required, string or `null`)
585+
Substring to search for. If `null`, the function returns `null`.
586+
587+
If using a field as the argument, this parameter supports only the following
588+
field datatypes:
589+
590+
* <<keyword,`keyword`>>
591+
* <<constant-keyword,`constant_keyword`>>
592+
* <<text,`text`>> field with a <<keyword,`keyword`>> or
593+
<<constant-keyword,`constant_keyword`>> sub-field
594+
595+
*Returns:* boolean or `null`
596+
====
597+
535598
[discrete]
536599
[[eql-fn-substring]]
537600
=== `substring`

0 commit comments

Comments
 (0)