Re: Regular Expressions; return a buried match
From: Álvaro G. Vicario <alvaro.NOSPAMTHANX_at_demogracia.com.invalid>
Date: Fri, 05 Feb 2010 12:28:03 +0100
Message-ID: <hkgvc4$vk8$1_at_news.eternal-september.org>
El 04/02/2010 21:27, Walt escribió/wrote:
> 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.
Date: Fri, 05 Feb 2010 12:28:03 +0100
Message-ID: <hkgvc4$vk8$1_at_news.eternal-september.org>
El 04/02/2010 21:27, Walt escribió/wrote:
> 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.
If it's fixed length data, I definitively agree with you.
-- -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain -- Mi sitio sobre programación web: http://borrame.com -- Mi web de humor satinado: http://www.demogracia.com --Received on Fri Feb 05 2010 - 05:28:03 CST