|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Parsing POP3 'LIST' outputI am trying to get the message IDs returned by the LIST command into a string list. For example, given the following input string: +OK 5 Messages( 4099 octets ) 1 9163 2 6962 3 8953 produce { "9163", "6969", "8953" }. using the following code: string[] msgIDs = Regex.Split( response, @"\d+ (\d+)", RegexOptions.Singleline ); This sort of works, except that the resulting array includes non-matches as well. Is it possible to return only the group values this way, or do I have to fiddle with MatchCollections, and Groups? Thanks, Aleko aleko.pet***@gmail.com wrote:
Show quote > Hi Possibly enough to change your match pattern to> > I am trying to get the message IDs returned by the LIST command into a > string list. > For example, given the following input string: > > +OK 5 Messages( 4099 octets ) > 1 9163 > 2 6962 > 3 8953 > > produce { "9163", "6969", "8953" }. > > using the following code: > > string[] msgIDs = Regex.Split( response, @"\d+ (\d+)", > RegexOptions.Singleline ); > > > This sort of works, except that the resulting array includes > non-matches as well. Is it possible to return only the group values > this way, or do I have to fiddle with MatchCollections, and Groups? ^\d+ (\d+)$ so only lines which *only* contain number-space-number will match -- Larry Lard Replies to group please |
|||||||||||||||||||||||