Replace all (replaceall)
Description
Searches for a value in a given string and returns a new string where all the occurrences (if any) are replaced by another indicated value. Note that this operation is case sensitive.
How does it work in the search window?
Select Create field in the search window toolbar, then select the Replace all operation. You need to specify three arguments:
Argument | Data type |
---|---|
Starting string mandatory | string |
Substring to search mandatory | string |
Substring to replace mandatory | string |
The data type of the values in the new field is string.
Example
In the siem.logtrust.web.activity
table, we want to create a new field that replaces GET by get in all the strings of the method field. To do it, we will create a new field using the Replace all operation.
The arguments needed to create the new field are:
String - method field
Substring to search - Click the pencil icon and enter GET
Substring to replace - Click the pencil icon and enter get
Click Create field and you will see the following result:
How does it work in LINQ?
Use the operator select
... as
... and add the operation syntax to create the new field. This is the syntax for the Replace all operation:
replaceall(string, string_to_search, string_to_replace)
Example
You can copy the following LINQ script and try the above example on the siem.logtrust.web.activity
table.Â
from siem.logtrust.web.activity
select replaceall(method, "GET", "get") as replaceall_method