Boost logo

Boost Users :

From: john.wismar_at_[hidden]
Date: 2003-05-30 10:58:16


The detail I'm concerned about -- and it may not be a problem because I
may be overlooking something -- is that the string I'm matching against
can have zero or one 'C' field and zero or one 'O' fields. It looks
like the "C(\\d+)|O(\\w+)" expression will match either of them if at
least one is present, but after that, I would need optionally to match
the other one. Matching the same field again would be an error. In
other words:

~C12345~OF <-- valid (1 of each)
~OF <-- valid (1 'O' field)
~C12345 <-- valid (1 'C' field)
~ZAQ~C12345 <-- valid (1 'C' field)
~OV~C67890 <-- valid (1 of each)
~A23~OV~DFG~C67890~ZAQ <-- valid (1 of each)
~A23~DFG <-- valid (neither)

~C12345~OF~C67890 <-- invalid (2 'C' fields)
~C12345~OF~OV <-- invalid (2 'O' fields)
~ASD~C12345~OF~OV <-- invalid (2 'O' fields)

Thanks again for your help!!

------------------------------
John Wismar
BSA - AllData Offline Products
john.wismar_at_[hidden]

> -----Original Message-----
> From: John Maddock [mailto:john_maddock_at_[hidden]]
> Sent: Friday, May 30, 2003 3:43 AM
> To: Boost-Users_at_[hidden]
> Subject: Re: [Boost-Users] Regex: matching either of 2
> fields, in any order
>
>
> > I can see how I could do this in a loop to replace the different
> > subfields. Is there another step I would need to take to
> guarantee that
> > there is at most one of each type of subfield?
>
> Well if you search for "C(\\d+)|O(\\w+)" it can only match
> one or the other
> can't it? Or am I missing something?
>
> 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