Subject | Re: [firebird-support] Why this similar to is wrong? |
---|---|
Author | Tim Ward |
Post date | 2014-11-25T13:39:37Z |
On 25/11/2014 13:29,
sirhamacker@... [firebird-support] wrote:
Well, just a couple of general observations: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.
- there is no such thing as a regular expression that can validate an email address, at best you can get an approximation that works "quite often" but still gets it wrong sometimes
- there are dozens of languages all with slightly different rules for regular expressions, it's not a surprise if any non-trivial regular expression needs changing between languages, you just have to read the rules for the new language.
-- Tim Ward