substring regular expression

From: Barry Brunning <barry(dot)brunning(at)datastream(dot)com(dot)au>
To: pgsql-novice(at)postgresql(dot)org
Subject: substring regular expression
Date: 2013-09-27 06:35:46
Message-ID: 9AC7EDC5-5C1A-4A3A-9B4D-F7F1FB691656@datastream.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Dear Colleague

This works (returns 12345):
select substring('ABC 12345 XYZ' from '%#"[0-9][0-9][0-9][0-9][0-9]#"%' for '#') as found_5_digits;

While this fails (returns blank):
select substring('ABC 12345 XYZ' from '%#"[0-9]{5}#"%' for '#') as no_5_digits;

Am I misunderstanding the documentation on using [0-9]{5} or do you think it's a bug?

TIA
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Barry Brunning | Data Stream Pty Limited | p/f. +612 9982 3550 | w. http://www.datastream.com.au

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Sergey Konoplev 2013-09-27 23:29:21 Re: substring regular expression
Previous Message Thara Vadakkeveedu 2013-09-25 11:11:45 Re: Uninstall postgresql 9.2 on red hat linux