Boost logo

Boost Users :

From: John Kiopela (john.kiopela_at_[hidden])
Date: 2007-12-02 07:36:27


Hi all,

I am having some troubles with making a regular expression to parse a file
of financial data. First, the file looks like this (simplified):

  BEGIN FINANCIAL INFORMATION
  0
  4
  John (the name is mentioned somewhere between the two tags)
  6
  3
  8
  END FINANCIAL INFORMATION

  BEGIN FINANCIAL INFORMATION
  0
  David
  6
  8
  END FINANCIAL INFORMATION

  BEGIN FINANCIAL INFORMATION
  2
  4
  7
  4
  0
  3
  John
  6
  8
  END FINANCIAL INFORMATION

I want to create a regular expression which gives me all financial
informations of John. My first try was:

"BEGIN FINANCIAL INFORMATION.*?John.*?END FINANCIAL INFORMATION"

The problem here is that the second ".*?" also matches "END FINANCIAL
INFORMATION", which means that the following substring is also a match:

  BEGIN FINANCIAL INFORMATION
  0
  David
  6
  8
  END FINANCIAL INFORMATION

  BEGIN FINANCIAL INFORMATION
  2
  4
  7
  4
  0
  3
  John
  6
  8
  END FINANCIAL INFORMATION

Can somebody please help me with this regular expression? I'm trying to find
out how I can type "any character except the string 'END FINANCIAL
INFORMATION'", but without succes so far.

Thanks in advance. Kind regards,

John



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net