Re: Regular Expressions; return a buried match

From: cate <catebekensail_at_yahoo.com>
Date: Thu, 4 Feb 2010 16:17:50 -0800 (PST)
Message-ID: <391929f9-c318-47ae-85e9-67882e9e54f7_at_r24g2000yqd.googlegroups.com>



On Feb 4, 2:27 pm, Walt <walt_ask..._at_SHOESyahoo.com> 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.
>
> //Walt

Thanks all. I think we'll surrender and let perl handle this. Walt, I'll forward your comment to the client. :-) Received on Thu Feb 04 2010 - 18:17:50 CST

Original text of this message