Re: Regular Expressions Insert

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Nick Malik (nickmalik_at_hotmail.nospam.com)
Date: 09/01/04


Date: Wed, 01 Sep 2004 06:02:04 GMT

Oh, for goodness sakes...
In psuedocode

   open the input file
   open the output file
   Read a row
   While not EOF
   {
          OutputFile.WriteLine("{0}/"{1}", InputRow.Substring(1,15),
InputRow.Substring(16));
          read next row
   }
   close all files

Why use a regex for a simple positional thing like this?

--- N

"J" <J@discussions.microsoft.com> wrote in message
news:3C7DBB14-56F8-4458-BFAE-24237B8AC442@microsoft.com...
> Hi group , I'm trying to do an insert of text into every line of a text
> file, e.g., insert double quotes ("") into position 15 through the entire
> file. Here is the expression:
> ([^\r\n]{15}[^\r\n]*\r\n). I want to insert text after the 15th character
> pos, but I when I do a replace it only replaces after the entire
expression.
> Do I need to do grouping with parens to control the replace? I'm
> learning..Thanks for any thoughts..



Relevant Pages

  • Re: return value?
    ... int main ... while )!= EOF) ... writes any of the characters from the input file to the output file. ...
    (comp.lang.c)
  • Re: Win32Forth documentation
    ... If the PNs match, the part is unchanged. ... deleted and the line from file 1 should be written to the output file ... The processing should continue until both files are at EOF. ... CHANGE1/2 and DELETE1 should be counted as ...
    (comp.lang.forth)
  • Re: Help is needed to compile C program using Visual Studie 2005
    ... the pdb file that was used when this precompiled header was created, ... an output file whose name has the following format: ... The length of input file paths and name must be less than 256; ... while(i < DefinedVariableArrayIndex) { ...
    (microsoft.public.vc.language)
  • Re: Need advice on File I/O
    ... open the input file and open an output file, ... you would still have the input file unchanged. ... On all currently supported operating systems, ...
    (comp.soft-sys.matlab)