[BUGS] BUG #14628: regex description in online documentationmisleadingly/wrong
От | t.glaser@tarent.de |
---|---|
Тема | [BUGS] BUG #14628: regex description in online documentationmisleadingly/wrong |
Дата | |
Msg-id | 20170420152549.24365.74331@wrigleys.postgresql.org обсуждение исходный текст |
Ответы |
Re: [BUGS] BUG #14628: regex description in online documentation misleadingly/wrong
|
Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 14628 Logged by: Thorsten Glaser Email address: t.glaser@tarent.de PostgreSQL version: 9.6.1 Operating system: GNU/Linux Description: https://www.postgresql.org/docs/9.6/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP clearly says that ~ matches a POSIX regular expression. This is only somewhat true: this does match: tarent=> SELECT 'a\bc' ~ '^[a\\b]*$';?column? ----------f (1 row) tarent=> SELECT 'a\b' ~ '^[a\\b]*$';?column? ----------t (1 row) But this does not match: tarent=> SELECT 'a\b' ~ '^[a\b]*$';?column? ----------f (1 row) The cause is likely this statement, burrowed way down in another chapter: “Note: PostgreSQL always initially presumes that a regular expression follows the ARE rules.” And indeed, it’s an ARE! tarent=> SELECT 'a\b' ~ '(?e)^[a\b]*$';?column? ----------t (1 row) I find this extremely misleading (it also does not state whether it matches BRE or ERE by default, just “POSIX re”), especially as it’s extremely important to know precisely what RE syntax you’re targetting when escaping a user-provided string into part of a RE (you have to precisely know where to escape and where to not escape, for example), which is why I personally always use POSIX standard RE (normally BRE). Please indicate in *all* places in the documentation dealing with regular expressions that it’s about ARE and link ARE to the section in the manual explaining it - https://www.postgresql.org/docs/9.6/static/functions-matching.html#POSIX-SYNTAX-DETAILS - in all of those places. Also, make clear at the beginning of that section how to force standard POSIX RE (i.e. BRE and ERE). -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
В списке pgsql-bugs по дате отправления: