Re: Regular Expressions; return a buried match

From: Walt <>
Date: Thu, 04 Feb 2010 15:27:16 -0500
Message-ID: <F4Gan.239277$>

cate wrote:
> select REGEXP_SUBSTR(encodedField, '^\d{4}(\d\d)') from table;
> I want the 5th and 6th digit. Can Oracle do this?

If the 5th and 6th digit have meaning on their own, then they should have been modeled as their own field(s) instead of concatenated into a composite field.

That said, yes, one can extract them with simple expressions. Several examples have already been given. I don't see why regular expressions are necessary, but they will work. SUBSTR should work, unless the data is more hinky than you've let on.

//Walt Received on Thu Feb 04 2010 - 14:27:16 CST

Original text of this message