Subject RE: [Firebird-Architect] Regarding the new SIMILAR TO in FB 2.5
Author Leyne, Sean
Dany,

> When doing advanced work concerning language research and phonetics
> regexps are extensively used. Amongst a plethora of advanced
> validation tasks we use regexp for manipulating strings. In this
> scenario it is extremely important not only to be able to tell if
> there is a match, but also where in the string the (first) match was
> found.
>
> Thus, in the expression
>
> 'banana' SIMILAR TO 'a+'
>
> we would need to have a return value of 2, not merely true
>
> 'banana' SIMILAR TO 'c+' could return 0.
>
> In the release notes for FB 2.5 I cannot see that this is possible.
> One could also, in order to maintain the current design, wish for an
> alternate predicate such as SIMILAR POS.
>
> Would this be possible?

I don't think it is appropriate/necessary to complicate the current
SIMILAR TO functionality.

Nothing prevents you from implementing your own SIMILAR TO function via
a UDF.


> Another important thing that the release notes does not mention is
> being able to use variables in PSQL on both sides of the new
> predicate(s).

That is because as a predicate, all of the existing rules for the
handling of variables apply. There is nothing special about SIMILAR TO.


Sean