Re: regular expression question

Поиск
Список
Период
Сортировка
От Jeff Eckermann
Тема Re: regular expression question
Дата
Msg-id 20030604194456.63394.qmail@web20806.mail.yahoo.com
обсуждение исходный текст
Ответ на regular expression question  (Joel Rodrigues <borgempath@Phreaker.net>)
Ответы Re: regular expression question  (Joel Rodrigues <borgempath@Phreaker.net>)
Список pgsql-general
--- Joel Rodrigues <borgempath@Phreaker.net> wrote:
> Hi,
> I'm trying to write a check on a column restricting
> the data to
> numerals from 0-9, commas,  dashes '-' and single
> spaces. To
> allow the entry of something like "134-140,
> 310-312".
>
> I seem to have got everything but the single spaces.
>
> '^[0-9|,-]{0,10}$'

'^[0-9, -]*$'

The ordering inside the square brackets doesn't
matter, except that the "-" needs to be somewhere
where it cannot be mistaken for a range operator.  The
conditions for that vary according to the
implementation, but I think the above should work with
PostgreSQL.

Change the "*" to "+" if you want to require something
to be entered.

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: to copy a record
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: speed w/ OFFSET/LIMIT