Can we make regexp processing more friendly by recognizing "\r\n" as a "newline" for "^$" purposes?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Can we make regexp processing more friendly by recognizing "\r\n" as a "newline" for "^$" purposes?
Дата
Msg-id CAKFQuwYb92TXJ+EcL9dr7MACbHWRR8Ri976oGm_wtW6D7nh92w@mail.gmail.com
обсуждение исходный текст
Ответы Re: Can we make regexp processing more friendly by recognizing "\r\n" as a "newline" for "^$" purposes?
Список 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.

В списке pgsql-general по дате отправления:

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: PSQL Tools
Следующее
От: jwiencek3@comcast.net
Дата:
Сообщение: Re: PSQL Tools