Testing the created function via the SQL Server editor - Cloud

Talend Cloud Data Management Platform Studio User Guide

Version
Cloud
Language
English (United States)
Product
Talend Cloud
Module
Talend Management Console
Talend Studio
Content
Design and Development

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