Thank you very much Mark for detailed info but i have more questions.

I am really curious. 
Is this sql standard concept that i must do this in this crap way? 
SELECT substring('ab11c' similar '[[:ALPHA:]]+#"[0-9]+#"[[:ALPHA:]]+' escape 
'#') FROM RDB$DATABASE
Also strange that i must consume whole string by reg expression not only part 
of it. 
This can be as an option but as default it is strange for me.


Why not simply do:
SELECT substring('ab11c12bcd' similar '[0-9]+' itemNumber 1) FROM RDB$DATABASE
Will simply return „11”

SELECT substring('ab11c22bcd' similar '[0-9]+' itemNumber 2) FROM RDB$DATABASE
Will simply return 22


Now i have 2 udf like this: 
REG_MATCH
REG_MATCH_COUNT

and i supposed that i can replace it with built in one, but i see that this is 
really terrible.
Above udfs i can use in this way

SELECT REG_MATCH(‘ab11c22bcd’, ‘[0-9]+’, 1) FROM RDB$DATABASE
Return 11
SELECT REG_MATCH(‘ab11c22bcd’, ‘[0-9]+’, 2) FROM RDB$DATABASE
Return 22

SELECT REG_MATCH_COUNT(‘ab11c22bcd’, ‘[0-9]+’) FROM RDB$DATABASE
Return 2

I can use it in the where clause:
SELECT * FROM MY_TABLE T WHERE REG_MATCH_COUNT(T.FIELD, ‘[0-9]+’)>2
Or
SELECT * FROM MY_TABLE T WHERE REG_MATCH(T.FIELD, ‘[0-9]+’, 1)=’11’

regards,
Karol Bieniaszewski
  • [firebi... liviuslivius liviusliv...@poczta.onet.pl [firebird-support]
    • Re... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
      • ... Karol Bieniaszewski liviusliv...@poczta.onet.pl [firebird-support]
        • ... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
          • ... Karol Bieniaszewski liviusliv...@poczta.onet.pl [firebird-support]

Reply via email to