Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / June 2006

Tip: Looking for answers? Try searching our database.

Parsing POP3 'LIST' output

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aleko.petkov@gmail.com - 09 Jun 2006 03:35 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.