Re: SELECT substring with regex

Поиск
Список
Период
Сортировка
От Aaron Bono
Тема Re: SELECT substring with regex
Дата
Msg-id bf05e51c0607071245w3738e109l8128d345f5b06977@mail.gmail.com
обсуждение исходный текст
Ответ на Re: SELECT substring with regex  ("Rodrigo De Leon" <rdeleonp@gmail.com>)
Ответы Re: SELECT substring with regex
Список pgsql-sql
On 7/7/06, Rodrigo De Leon <rdeleonp@gmail.com> wrote:
On 7/7/06, T E Schmitz <mailreg@numerixtechnology.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.

-Aaron

В списке pgsql-sql по дате отправления:

Предыдущее
От: "Aaron Bono"
Дата:
Сообщение: Fwd: Atomar SQL Statement
Следующее
От: T E Schmitz
Дата:
Сообщение: Re: SELECT substring with regex