Using a regular expression function on SQL Server - Cloud - 7.3

Talend Studio User Guide

Talend Big Data
Talend Big Data Platform
Talend Cloud
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Talend Studio
Design and Development
Last publication date
Available in...

Big Data Platform

Cloud API Services Platform

Cloud Big Data Platform

Cloud Data Fabric

Cloud Data Management Platform

Data Fabric

Data Management Platform

Data Services Platform

MDM Platform

Real-Time Big Data Platform

Before you begin

  • You have deployed the regular expression function to the SQL server.
  • You have tested the regular expression.
  • You have selected the Profiling perspective.

About this task

Before being able to use regular expressions on analyzed columns in a database, you must first declare the created regular expression function, RegExMatch in this example, in the specified database.
Here is the code used in this example:
Using System;
Using Microsoft.SqlServer.Server;
Using System.Text.RegularExpressions;
Public partial class RegExBase
     [SqlFunction(IsDeterministic = true, IsPrecise = true)]
     Public static int RegExMatch( string matchString , string pattern)
            Regex r1 = new Regex(pattern.TrimEnd(null));
            if (r1.Match(matchString.TrimEnd(null)).Success == true) 
                 return 1 ;
                 return 0 ;


  1. In the DQ Repository tree view, expand Libraries > Indicators > System Indicators > Pattern Matching.
  2. Double-click Regular Expression Matching, or right-click it and select Open from the contextual menu.
    The corresponding view displays the indicator metadata and its definition.
    You must add to the list of databases the database for which you want to define a query template. This query template will compute the regular expression matching.
  3. Click the [+] button at the bottom of the Indicator Definition view.
    An empty row is added at the bottom of the view.
  4. In the new field, click the arrow and select the database for which you want to define the template, Microsoft SQL Server in this example.
  5. Copy the indicator definition of any of the above databases.
  6. Click the Edit... button next to the new field.
    The Edit expression dialog box is displayed.
  7. Paste the indicator definition (template) in the Expression box and then modify the text after WHEN in order to adapt the template to the selected database.
  8. Click OK to proceed to the next step. The new template is displayed in the field.
  9. Click the save icon on top of the editor.


For more detailed information on how to declare a regular expression function in the Studio, see Defining a query template for a specific database and Declaring a User-Defined Function in a specific database.