Posted By

arangil on 10/26/09


Tagged

regex


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

vali29
khouser
franksmile0310
mheinrich


Parsing with regex


 / Published in: C#
 

In case you find yourself parsing a string with unrecognizable ASCII character codes, use the regex below to replace them. The pattern matches only the valid keyboard symbols.

  1. string st =
  2. "45857875-08-545-K TESTDOCS INC 2008010320080103184514184516184516 0 ";
  3.  
  4. st = Regex.Replace(st, @"[^\x20-\x7E]", "");

Report this snippet  

You need to login to post a comment.