Subject Re: [firebird-support] Built in RegEx Capability?
Author Mark Rotteveel
On 12-2-2019 10:34, Mark Rotteveel mark@...
[firebird-support] wrote:

> In your case, you will need 3 separate substrings:
>
> select x,
> substring(x similar 'V#"[[:DIGIT:]]+#"%.pdf' escape '#') as VERSION,

I just noticed that it is safer to use 'V#"[[:DIGIT:]]+#" %.pdf' (space
before %), as I have noticed that quotes make the quoted part greedy,
while otherwise it is non-greedy.

Eg
substring(x similar 'V#"[[:DIGIT:]]+#"%.pdf' escape '#') yields '12'

but

substring(x similar 'V[[:DIGIT:]]+#"%#".pdf' escape '#')

yields '2 p234 The state of the nation'

--
Mark Rotteveel