Subject Re: [firebird-support] Why this similar to is wrong?
Author Walter R. Ojeda Valiente
Hello

I use the following SELECT when want to validate an e-mail address and works fine for me:

SELECT
   IIF('email@...' SIMILAR TO '[[:ALNUM:]-*_*.*]*@[[:ALNUM:]-*_*.*]*.[[:ALNUM:]-*_*.*]*', 'ok', 'fail')
FROM 
   RDB$DATABASE

Of course, that is not perfect, but works.

Greetings.

Walter.


On Tue, Nov 25, 2014 at 9:29 AM, sirhamacker@... [firebird-support] <firebird-support@yahoogroups.com> wrote:
 

select 

       iif('email@...' similar to '([_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+)','ok','fail')

from rdb$database


Says 'invalid string' and 'invalid pattern', but the pattern it´s the same in other languages for validate email address.