Using regular expressions with Teradata
To identify incorrect data, you may want to use Pattern indicators. These indicators use regular expression to work. In Teradata, the regular expression function is only installed by default starting from version 14.
To use the regular expression function in a Teradata version prior to 14, you need to install a User Defined Function (UDF).
Creating a user on Teradata
You must create a Teradata user with CREATE FUNCTION and
EXECUTE FUNCTION access rights.
Procedure
Creating a User Defined Function using a C program
You can create a User Defined Function (UDF) function using a C program and
install it on the Teradata database in order to use regular expressions.
Before you begin
- Retrieve the Regex_INSTR.c file from the Downloads tab in the left panel of this page.
Procedure
Editing the pattern indicator and using it in a column analysis
Before being able to use regular expressions on analyzed columns in a database, you
must first declare the created regular expression function by adding the SQL instruction
and the pattern.
Procedure
Using the Pattern Test view
In the Pattern Test View, you can test a string of text against
a regular expression.
Procedure
- On the menu bar of Talend Studio , click .
- In the filter field, start typing Pattern Test View.
- Select Pattern Test View and click OK.
- Select the DB Connections option then select your Teradata connection from the list.
- In the Test Area and Regex fields, enter your test string and your regular expression respectively.
- Click the Test button.
Results
A matches or non-matches text is displayed in the view.