home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 19,198 of 19,505   
   rja.carnegie@gmail.com to All   
   Regular expression question   
   10 Jul 15 08:05:43   
   
   SQL Server 2005.  The second and third versions of the   
   following statement print 'Yes', which is unexpected.   
      
   The intention is to test whether the first term is   
   a compound house "number" such as '1A' or '1-3'.   
   Either / or \ I thought would perform an "escape"   
   in the pattern string, to treat a following special   
   character as the literal character, but it seems to   
   perform correctly without that, not with.  So this   
   test may be not doing what I think it is, at all.   
   And the question is: uh?  ;-)   
      
   IF ( '15' LIKE N'[1-9]%[-A-Z]%'  ) PRINT 'Yes 1'   
      
   IF ( '15' LIKE N'[1-9]%[/-A-Z]%' ) PRINT 'Yes 2'   
      
   IF ( '15' LIKE N'[1-9]%[\-A-Z]%' ) PRINT 'Yes 3'   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca