[[eql-function-ref]]
== EQL function reference
++++
Function reference
++++
experimental::[]
{es} supports the following EQL functions:
* <>
[discrete]
[[eql-fn-substring]]
=== `substring`
Extracts a substring from a source string at provided start and end positions.
If no end position is provided, the function extracts the remaining string.
[%collapsible]
====
*Example*
[source,eql]
----
substring("start regsvr32.exe", 6) // returns "regsvr32.exe"
substring("start regsvr32.exe", 0, 5) // returns "start"
substring("start regsvr32.exe", 6, 14) // returns "regsvr32"
substring("start regsvr32.exe", -4) // returns ".exe"
substring("start regsvr32.exe", -4, -1) // returns ".ex"
----
*Syntax*
[source,txt]
----
substring(, [, ])
----
*Parameters*
``::
(Required, string)
Source string.
``::
+
--
(Required, integer)
Starting position for extraction.
If this position is higher than the `` position or the length of the
`` string, the function returns an empty string.
Positions are zero-indexed. Negative offsets are supported.
--
``::
(Optional, integer)
Exclusive end position for extraction. If this position is not provided, the
function returns the remaining string.
+
Positions are zero-indexed. Negative offsets are supported.
*Returns:* string
====