title: .NET Regex - Replace multiple characters at once without overwriting?
body: <p>I'm implementing a c# program that should automatize a Mono-alphabetic substitution cipher.
  The functionality i'm working on at the moment is the simplest one: The user will provide a plain text and a cipher alphabet, for example:</p>
  
  <p>Plain text(input): THIS IS A TEST</p>
  
  <p>Cipher alphabet: A -> Y, H -> Z, I -> K, S -> L, E -> J, T -> Q</p>
  
  <p>Cipher Text(output): QZKL KL QJLQ</p>
  
  <p>I thought of using regular expressions since I've been programming in perl for a while, but I'm encountering some problems on c#.
  First I would like to know if someone would have a suggestion for a regular expression that would replace all occurrence of each letter by its corresponding cipher letter (provided by user) at once and without overwriting anything.</p>
  
  <h2>Example:</h2>
  
  <p>In this case, user provides plaintext "TEST", and on his cipher alphabet, he wishes to have all his T's replaced with E's, E's replaced with Y and S replaced with J. My first thought was to substitute each occurrence of a letter with an individual character and then replace that character by the cipherletter corresponding to the plaintext letter provided.</p>
  
  <p>Using the same example word "TEST", the steps taken by the program to provide an answer would be:</p>
  
  <ol>
  <li>replace T's with (lets say) @</li>
  <li>replace E's with #</li>
  <li>replace S's with &amp;</li>
  <li>Replace @ with E, # with Y, &amp; with j</li>
  <li>Output = EYJE</li>
  </ol>
  
  <p>This solution doesn't seem to work for large texts. 
  I would like to know if anyone can think of a single regular expression that would allow me to replace each letter in a given text by its corresponding letter in a 26-letter cipher alphabet without the need of splitting the task in an intermediate step as I mentioned.</p>
  
  <p>If it helps visualize the process, this is a print screen of my GUI for the program: <a href="http://img43.imageshack.us/img43/2118/11618743.jpg" rel="nofollow noreferrer">alt text http://img43.imageshack.us/img43/2118/11618743.jpg</a></p>