Search Postgresql Archives

Regexp confusion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx <mailto:doug.gorley@xxxxxxxxx>



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux