Wrox Programmer Forums
|
.NET Framework 1.x For discussing versions 1.0 and 1.1 of the Microsoft .NET Framework.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 1.x section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 8th, 2007, 11:35 AM
Registered User
 
Join Date: Feb 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default urgent: RegEx to read a Text File

Hi All,
    I have to read a text file that's follows bellow:

          int#string#string
          int#string#string
          int#string#string
          ...

    I would like me read this, using RegEx and StreamReader classes.

              I want to use RegEx to create a format validator and to tockenize the diferent parts of the line.
             ,and StreamReader in order to do my code clearer.

Can you say me How I can to set RegEx pattern, and Hoy I can obtain the matches?

Thanks for all in advance.

--JORDI--
 
Old February 8th, 2007, 11:42 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

If you are strict with the format, i.e. the data always contains the # character as a separator, it would probably be easier to just use the String.Split() method to create an array of values for each line. RegEx seems like overkill.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
read text file senthilreddy ASP.NET 1.0 and 1.1 Basics 1 December 19th, 2010 10:56 PM
Read and Edit the text file stuartlittle C# 3 February 26th, 2008 05:35 AM
Read Text file and convert to Binary file VB.net sjlsysprg1 Pro VB.NET 2002/2003 4 June 29th, 2007 06:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.