Jul 282008
 

I had previously created a pipeline to replace any string.  What I liked about it was its simplicity.  I could just put the string I wanted replaced, followed by a comma then the string I wanted as the replacement.  I wanted to expand that functionality to allow replacing commas and other characters including HEX characters.  Regex was my solution, so my new version allows you to replace any string with another using Regex expressions for .NET.  Just include as many replacements as you’d like separated by commas.

 

Here’s a sample Regex expression I included:

(\d)\x2C(\d),$1$2,»,HEX CHAR,FRANK,RIZZO

 

It replaces

1.  a digit surrounded comma with nothing ((\d)\x2C(\d),$1$2)

2.  a HEX character “»” with the words HEX CHAR (»,HEX CHAR)

3.  The word FRANK with RIZZO (FRANK,RIZZO)

 

Here is my input file:

image

Here is my output file:

image

 

Note to Self:  Don’t forget to put parentheses around the groups for which you are searching.  It allows the $n to work.

 

If you’d like a copy click here.

  • Raja Kumaravel

    Nice work. Lemme get your source code.

    Thanks,
    Raja Kumaravel