Testing the created function via the SQL Server editor - 7.1

Talend Data Management Platform Studio User Guide

author
Talend Documentation Team
EnrichVersion
7.1
EnrichProdName
Talend Data Management Platform
task
Design and Development
EnrichPlatform
Talend Studio

Procedure

  1. copy the below code and execute it:
    create table Contacts (
    FirstName nvarchar(30),
     LastName nvarchar(30),
    EmailAddress nvarchar(30) CHECK
     (dbo.RegExMatch('[a-zA-Z0-9_\-]+@([a-zA-Z0-9_\-]+\.)
     +(com|org|edu|nz)',
    EmailAddress)=1),
    USPhoneNo nvarchar(30) CHECK
     (dbo.RegExMatch('\([1-9][0-9][0-9]\) [0-9][0-9][0-9]
    \-[0-9][0-9][0-9][0-9]',
    UsPhoneNo)=1))
    
    INSERT INTO [talend].[dbo].[Contacts]
                            ([FirstName]
                           , [LastName]
                           , [EmailAddress]
                           , [USPhoneNo])
           VALUES
                         ('Hallam'
                        , 'Amine'
                        , 'mhallam@talend.com'
                        , '0129-2090-1092')
                        , ( 'encoremoi'
                         , 'nimportequoi'
                         , 'amine@zichji.org'
                         , '(122) 190-9090')
    GO
  2. To search for the expression that match, use the following code:
    SELECT [FirstName]
         , [LastName]
         , [EmailAddress]
         , [USPhoneNo]
      FROM [talend].[dbo].[Contacts]
      where [talend].[dbo].RegExMatch([EmailAddress],
    '[a-zA-Z0-9_\-]+@([a-zA-Z0-9_\-]+\.)+(com|org|edu|nz|au)')
    = 1 
    
    
  3. To search for the expression that do not match, use the following code:
    SELECT [FirstName]
         , [LastName]
         , [EmailAddress]
         , [USPhoneNo]
      FROM [talend].[dbo].[Contacts]
      where [talend].[dbo].RegExMatch([EmailAddress],
    '[a-zA-Z0-9_\-]+@([a-zA-Z0-9_\-]+\.)+(com|org|edu|nz|au)')
    = 0