From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Can we make regexp processing more friendly by recognizing "\r\n" as a "newline" for "^$" purposes? |
Date: | 2015-10-18 17:49:22 |
Message-ID: | CAKFQuwYb92TXJ+EcL9dr7MACbHWRR8Ri976oGm_wtW6D7nh92w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Other implementation of regular expressions handle "newline" mechanics
related to "^" and "$" semantically instead of literally. By that I mean
that both "\r\n" and "\n" are considered "newlines" instead of just "\n".
If changing behavior is not desirable I would be content with another flag
that would toggle such behavior.
In code - both of these subqueries should match whereas presently only the
first one does.
SELECT regexp_matches(E'123\n', E'123$', 'w');
SELECT regexp_matches(E'123\r\n', E'123$', 'w');
I don't know if this is server O/S dependent...but I would not expect it to
be so.
Having to say something like: , 'wr' (r =
combine-\r-with-adjacent-newline) would be OK but not ideal. I'm not
seeing much risk in changing this particular behavior.
Thanks!
David J.
P.S. Forgive me for re-iterating the dislike of calling and describing "w"
as "weird" and "rarely useful". I find it to be quite useful and my source
material doesn't seem particularly unusual.
From | Date | Subject | |
---|---|---|---|
Next Message | jwiencek3 | 2015-10-18 22:02:38 | Re: PSQL Tools |
Previous Message | Thomas Kellerer | 2015-10-18 16:05:57 | Re: PSQL Tools |