Subject Re: [firebird-support] Extract email addresses from blob via LIST and SIMILAR TO
Author Michael Ludwig
Roberto Carlos schrieb am 27.12.2010 um 14:11 (-0200):
> In a stored procedure, I extract the words of a blob text in a
> variable. Then, I try to test whether that word is an email or not by:
> ---------------
> while ...
> ...
> if (WordVariable similar to
> ('\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b')) then
> Supend;
> ...
> end

A Perl-style word boundary (\b) is not supported in Firebird's (or
SQL's) regular expressions. There are other issues with this expression
in the context of matching email addresses, both in general and with
regard to Firebird. Just forget it.

> This RegEx was taken from
> but does not work in this case.

Take a look at the Firebird 2.5 release notes to understand what is
supported and what isn't.

> Is that regular expression wrong according to Firebird 2.5 rules?

Yes, syntactically wrong. You can find that out yourself very easily
using isql by doing:

select 1 from rdb$database where 'eins' similar to 'ei%';

Michael Ludwig