Serg
Serg

Reputation: 93

Extract only numbers using regexp

I am new to tableau, and am trying to write a regular expression which returns a number that is between parentheses. The input field has several lines. The word "Resolution" is a keyword.

Example:

1. text "Resolution(05:10): text"
2. text "Resolution(15:03): text"

Desired result:

01. 05:10
02. 15:03

Upvotes: 0

Views: 794

Answers (1)

Wiktor Stribiżew
Wiktor Stribiżew

Reputation: 627327

You may use REGEXP_EXTRACT_NTH:

REGEXP_EXTRACT_NTH([column], '\((\d{2}:\d{2})\)', 1)

The \((\d{2}:\d{2})\) matches a (, then captures into Group 1 two digits, :, and 2 more digits, then matches a ). The 1 in the function is the ID of the first capturing group in the pattern.

See this Tableau blog showing how to use regular expressions with Tableau.

Upvotes: 2

Related Questions