Search Postgresql Archives

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

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

 



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.


[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