Subject Re: ODP: [firebird-support] Built in RegEx Capability?
Author Mark Rotteveel
On 2019-02-12 18:50, Lester Caine lester@... [firebird-support]
wrote:
> On 12/02/2019 16:36, Karol Bieniaszewski liviuslivius@...
> [firebird-support] wrote:
>> Select
>> D.NAZWA
>> , SUBSTRING(D.NAZWA FROM POSITION('V', D.NAZWA)+1 FOR POSITION('p',
>> D.NAZWA)-3) AS V
>> , SUBSTRING(D.NAZWA FROM POSITION('p', D.NAZWA)+1 FOR POSITION(' ',
>> SUBSTRING(D.NAZWA FROM POSITION('p', D.NAZWA)))-2) AS P
>> from
>> (SELECT 'V12 p234 The state of the nation.pdf' AS NAZWA FROM
>> RDB$DATABASE) D
>
> Moved over to FB3 server now and this works on a few edge cases which
> the regex fails on, such as 2 spaces before the 'p', but it also throws
> errors where the p element is broken - negative offset.

That sounds like a matter of fine-tuning the expression (which might
require a deeper dive into the syntax).

Mark