[pcre-dev] [Bug 774] Capturing groups and alternatives

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 774] Capturing groups and alternatives
------- You are receiving this mail because: -------
You are on the CC list for the bug.

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




--- Comment #1 from Philip Hazel <ph10@???> 2008-10-22 20:24:59 ---
On Wed, 22 Oct 2008, Edwin Boatswain wrote:

> If I have a regular expression such as the following:
> ^Recv\(([\d/\-:\.]+)\)|Send\(([\d/\-:\.]+)\)
> Which is supposed to capture a timestamp from a line of text like:
> Send(10/06/2008-07:45:06.668)|8=FIX.4.2?9=00246...
> Note the string contains \a characters.
> I can match the line with the above expression but when I try to extract group
> 1 I get the entire string preceded by by some non-ascii characters.


Firstly, you should not expect group 1 to be set; the parentheses after
"Send" will be numbered 2. This works fine for me when I use pcretest
under Linux:

$ pcretest
PCRE version 7.7 2008-05-07

re> "^Recv\(([\d/\-:\.]+)\)|Send\(([\d/\-:\.]+)\)"
data> Send(10/06/2008-07:45:06.668)|8=FIX.4.2^A9=00246...

0: Send(10/06/2008-07:45:06.668)
1: <unset>
2: 10/06/2008-07:45:06.668
data>


I am not a Windows user, so I cannot test it under windows.

Philip


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