[pcre-dev] [Bug 1315] \r, \n and $ matching seems to be ill…

Top Page
Delete this message
Author: Zoltan Herczeg
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 1315] \r, \n and $ matching seems to be illogical or not fully documented.
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1315

Zoltan Herczeg <hzmester@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hzmester@???





--- Comment #1 from Zoltan Herczeg <hzmester@???> 2012-11-07 09:52:59 ---
Hi Chris, next time you should be a little more polite. That could help a lot.

What you misunderstand here is that $ is not a character range, such as [a-z],
it is a zero-width assertion.

e.g: /a$[^x]b/m matches to a\nb, since $ itself just checks a condition, but
does not change the character position.

\r[^\n] this pattern matches to two character long strings. E.g, it matches to
\rx but not to \r or \r\n. Here, [^\n] is a character range, so it does not
match at the end of the input.

\r[^$] also requires two characters, the first one is \r, followed by anything
which is not $ (here, $ is a plain character), so it matches to \r\n, but not
to \r$.

I hope now everything is clear.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email