| From: | T E Schmitz <mailreg(at)numerixtechnology(dot)de> |
|---|---|
| To: | Aaron Bono <postgresql(at)aranya(dot)com>, pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: SELECT substring with regex |
| Date: | 2006-07-07 20:12:52 |
| Message-ID: | 44AEC044.1040206@numerixtechnology.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Aaron Bono wrote:
> On 7/7/06, *Rodrigo De Leon* <rdeleonp(at)gmail(dot)com
> <mailto:rdeleonp(at)gmail(dot)com>> wrote:
>
> On 7/7/06, T E Schmitz <mailreg(at)numerixtechnology(dot)de
> <mailto:mailreg(at)numerixtechnology(dot)de>> wrote:
> > But that takes me to the next problem:
> >
> > For the sake of the example I simplified the regular pattern.
> > In reality, BASE_NAME might be:
> >
> > 28mm
> > 28-70mm
> >
> > So the reg. expr. requires brackets:
> >
> > substring (NAME, '^(\\d+(-\\d+)?mm)' ) as BASE_NAME
> >
> > Actually, the pattern is more complex than that and I cannot see
> how I
> > can express it without brackets.
>
> Maybe:
>
> select
> substring ('150mm LD AD Asp XR Macro', '^[\\d-]*mm' ) as BASE_NAME
> , substring('150mm LD AD Asp XR Macro','^[\\d-]*mm (.*)$') as SUFFIX;
>
> select
> substring ('28-70mm LD AD Asp XR Macro', '^[\\d-]*mm' ) as BASE_NAME
> , substring('28-70mm LD AD Asp XR Macro','^[\\d-]*mm (.*)$') as SUFFIX;
>
> etc...
>
> Regards,
>
> Rodrigo
>
>
> Is there a reason this column wasn't separated into two different
> columns? Or perhaps into a child table if there could be more than one
> XXXmm value in the field?
>
> Just curious.
You're absolutely right (see my other posting):
what was entered:
MODEL.NAME "150mm F4 E" TYPE.NAME -
MODEL.NAME "150mm F4 PE" TYPE.NAME -
what should've been entered:
MODEL.NAME "150mm F4"
TYPE.NAME "PE"
TYPE.NAME "E"
both referencing the same MODEL
--
Regards,
Tarlika Elisabeth Schmitz
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jim Buttafuoco | 2006-07-07 20:34:32 | Re: SELECT substring with regex |
| Previous Message | Aaron Bono | 2006-07-07 19:45:51 | Re: SELECT substring with regex |