I'm still in learning mode with regular expressions and am attempting a few things during a Trasformation task from one table to another. Basically what I'm trying to to is this: during the copy/import from one table to another, I'm trying to somewhat validate an email field. When it returns valid I want it mapped directly to the corresponding column in the destination, but when it doesn't match to the expression, I want it moved to a different column. What I've got so far is this:
Function Main()
Dim objRE
Dim strExample
set objRE = new RegExp
objRE.Pattern = "^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$"
strExample = TRIM( DTSSource("CAP_EMAIL") )
' Test if a match is found
If objRE.Test(strExample) = True Then
DTSDestination("CAP_EMAIL") = DTSSource("CAP_EMAIL")
Else
DTSDestination("invalidCapEmail") = DTSSource("CAP_EMAIL")
End If
Set objRE = Nothing
Main = DTSTransformStat_OK
End Function
It keep returning the following error: ActiveX Scripting Transform '<DTS Testing Transformation>': Function 'reg' was not found in the script.
Any help would be appreciated.
-Dan
Function Main()
Dim objRE
Dim strExample
set objRE = new RegExp
objRE.Pattern = "^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$"
strExample = TRIM( DTSSource("CAP_EMAIL") )
' Test if a match is found
If objRE.Test(strExample) = True Then
DTSDestination("CAP_EMAIL") = DTSSource("CAP_EMAIL")
Else
DTSDestination("invalidCapEmail") = DTSSource("CAP_EMAIL")
End If
Set objRE = Nothing
Main = DTSTransformStat_OK
End Function
It keep returning the following error: ActiveX Scripting Transform '<DTS Testing Transformation>': Function 'reg' was not found in the script.
Any help would be appreciated.
-Dan