Hi
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?
Thanks,
Aleko
Larry Lard - 09 Jun 2006 10:15 GMT
> Hi
>
[quoted text clipped - 17 lines]
> 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?
Possibly enough to change your match pattern to
^\d+ (\d+)$
so only lines which *only* contain number-space-number will match

Signature
Larry Lard
Replies to group please