dbTalk Databases Forums  

Regular expression in DTS

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Regular expression in DTS in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David Kleyman
 
Posts: n/a

Default Regular expression in DTS - 04-21-2004 , 12:44 PM






Hello

I have this pattern that I want to use to match parts of the string to the
(city, state zip_code) pattern. I know that it works outside of DTS but when
I try to use it in my DTS package I get this error
---------------------------
<DTS Testing Transform Task>
---------------------------
The number of failing rows exceeds the maximum specified.
Error Code: 0
Error Source= Microsoft VBScript runtime error
Error Description: Syntax error in regular expression


here is the code


PATTERN="(?n[A-Z]([a-z])+(\.?)(\x20[A-Z]([a-z])+){0,2})\,\x20(A[LKSZRAP]|C
[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]
Quote:
P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])\x20((?!0{5})\d{5}(-\d{4})?))$"
set RegExpCityStateZip = new RegExp
RegExpCityStateZip.Pattern = PATTERN

addr3 = TRIM( DTSSource("Col007") )
if ( addr3 ) <> "" Then
set Matches = RegExpCityStateZip.Execute( addr3 ) ' It fails on this
line
If Matches.Count > 0 Then
' the rest of the code is here

end if
end if

Any Ideas why would it fail

Thank you

David





Reply With Quote
  #2  
Old   
Davide
 
Posts: n/a

Default Re: Regular expression in DTS - 04-21-2004 , 07:07 PM






"David Kleyman" <test (AT) hotmail (DOT) com> wrote

Quote:
Hello

I have this pattern that I want to use to match parts of the string to the
(city, state zip_code) pattern. I know that it works outside of DTS but when
I try to use it in my DTS package I get this error
---------------------------
DTS Testing Transform Task
---------------------------
The number of failing rows exceeds the maximum specified.
Error Code: 0
Error Source= Microsoft VBScript runtime error
Error Description: Syntax error in regular expression


here is the code


PATTERN="(?n[A-Z]([a-z])+(\.?)(\x20[A-Z]([a-z])+){0,2})\,\x20(A[LKSZRAP]|C
[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]
|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])\x20((?!0{5})\d{5}(-\d{4})?))$"

set RegExpCityStateZip = new RegExp
RegExpCityStateZip.Pattern = PATTERN

addr3 = TRIM( DTSSource("Col007") )
if ( addr3 ) <> "" Then
set Matches = RegExpCityStateZip.Execute( addr3 ) ' It fails on this
line
If Matches.Count > 0 Then
' the rest of the code is here

end if
end if

Any Ideas why would it fail

Thank you

David



You could try removing the clause "Set Options to Explicit Capture" (
in other words delete this substring '?n:' from your
pattern).
If you try your original pattern frm VB 6 you should get an error like

'Error 5017 :Application-defined or object-defined error'

so i think it's not a matter of DTS.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.