Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
maxLevel2
typeflat

...

How does it work in the search window?

Select Create column field in the search window toolbar, then select the Substitute all operation. You need to specify three arguments:

Argument

Data type

More information

String to scan

string

You can select a column in the table or enter a value manually.

Regular expression 

regexp

You can select a column in the table or enter a value manually. If you introduce it yourself, you can use the regexp syntax to establish grouping patterns.

Template 

template

You can select a column in the table or enter a value manually. If you introduce it yourself, you can use the capturing group syntax to make reference to specific groups established by the regular expression.

The data type of the values in the new column field is string.

Note

Note that Devo automatically changes the strings manually entered in the Regular expression and Template arguments to the required regexp and template data types. If you want to use a column on these arguments, it must be a regexp/template type column. You can use the Regular expression, regexp (re) and Template (template) operations to transform a string column to the required data type.

Example

In the demo.ecommerce.data table, we want to replace all the (:) occurrences in every string of our timestamp column  field by a (-). To do it, we will create a new column field using the Substitute all operation.

...

Click Create column and you will see the following result:

...

We can also create a column in the demo.ecommerce.data table that substitutes the dots in IP addresses by spaces. To do it, we will create a new column using the Substitute all operation and we will call it Substituteall. Before that, we need to transform the clientIpAddress column into string type using the to string (str) operation and we will call it IPstring.

Once we have the IPstring columnfield, the arguments needed to create the new Substitute Substitute column are:

  • String to scan- IPstring column field

  • Regular expression - Click the pencil icon and enter the following syntax to group up to the first dot→ ([0-9]+)\.*

  • Template - Click the pencil icon and make reference to the capturing group specified by the regular expression syntax, followed by a space → \1

    Status
    subtletrue
    titlespace

...

Note

Note that when you enter a string value as a regular expression and template using LINQ, you have to transform them to regexp and template format using the Regular expression, regexp (re) and Template (template) operations, as you can see in the examples. This is not needed if you perform this operation directly from the search window interface, as said above.

Example

You can copy the following LINQ script and try the previous examples on the demo.ecommerce.data table. 

Code Block
from demo.ecommerce.data
  select subsall(timestamp, re(":"), template("-")) as substitute_timestamp_all

...