Regexp confusion
От | Doug Gorley |
---|---|
Тема | Regexp confusion |
Дата | |
Msg-id | 4ACFACEE.8050001@gmail.com обсуждение исходный текст |
Ответы |
Re: Regexp confusion
|
Список | pgsql-general |
Trying to match some numbers, and I'm having some regexp problems. I've boiled it down to the following: /* (1) */ select '3.14' similar to E'^\\d+\\.\\d+$'; -- true /* (2) */ select '3.14' similar to E'^\\d+(\\.\\d+)$'; -- true /* (3) */ select '3.14' similar to E'^\\d+(\\.\\d+)*$'; -- true /* (4) */ select '3.14' similar to E'^\\d+(\\.\\d+)?$'; -- false /* (5) */ select '3.14' similar to E'^\\d+(\\.\\d+)+$'; -- true So, based on (1) and (2), the pattern '\.\d+' occurs once. So why does (4) return false? between (3), (4), and (5), it appears as though the group is matching multiple times. Thanks, -- ------------------------------------------------------------------------ *Doug Gorley* | doug.gorley@gmail.com <mailto:doug.gorley@gmail.com>
В списке pgsql-general по дате отправления: