Re: regular expression question
От | Jim C. Nasby |
---|---|
Тема | Re: regular expression question |
Дата | |
Msg-id | 20030604195611.GD40542@flake.decibel.org обсуждение исходный текст |
Ответ на | regular expression question (Joel Rodrigues <borgempath@Phreaker.net>) |
Список | pgsql-general |
First, I'd suggest using the SQL99 SIMILAR functionality, since it's more portable. select '028-381, 283-183' similar to '[0-9|, -]+'; t {0,10} isn't supported, but you'd be best doing that just by defining the field to only be 10 characters. If that's not an option, char_length(field) <= 10 should also work. On Thu, Jun 05, 2003 at 12:10:18AM +0530, Joel Rodrigues 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}$' > > > Hope you can help ! > > Cheers, > Joel > -- Jim C. Nasby (aka Decibel!) jim@nasby.net Member: Triangle Fraternity, Sports Car Club of America Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?"
В списке pgsql-general по дате отправления: