Extract

<< Click to Display Table of Contents >>

Navigation:  Reference > Transforms >

Extract

Description

Extract text in one or more columns.

 

Examples

Extract the first 2 digits from the 'Product Id' column:

how to extract characters from a column example

 

Extract the last group of digits from an IP address:

 

extract-example-2

 

Extract titles from a name:

 

Extract title from name

 

Inputs

One.

 

Options

Check the column(s) you wish to transform.

Set Using depending on whether you want to extract a fixed length of text or with a regular expression.

Set Length to the length you want values in selected columns shortened to. Text match only.

Set From to Start or End depending on whether you want to take from the start or end. Text match only.

If From is Start then Offset is the offset of the first character from the start (0 to start with the first character). If From is End then Offset is the offset of the last character from the end (0 to start with the last character). Text match only.

Set Matching to a regular expression. Regex match only. If the expression contains capture parentheses the first capture will be extracted. Otherwise it will try to capture the whole regular expression. For example:

 

Value

Regular expression

Extracted

12.34.567.89

(\d*)\.\d*\.\d*\.\d*

12

12.34.567.89

\d*\.\d*\.\d*\.(\d*)

89

12.34.567.89

\d*\.\d*

12.34

ip 12.34.567.89

\d*\.\d*\.\d*\.\d*

12.34.567.89

ip 12.34.567.89

^\d*\.\d*\.\d*\.\d*$

 

 

Check case sensitive to use case sensitive matching. Regex match only.

 

Notes

If you can to keep the original column use Copy Cols to copy the column first.

Whitespace is counted when calculating length. You can use Whitespace to remove whitespace before extracting.

If you want to set a column to a fixed length use Pad and Extract together.

Use Replace If you want to extract multiple captures from a value using a regular expression.

 

See also

Chop