Parsing with regex


/ Published in: C#
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. string st =
  2. "45857875-08-545-K TESTDOCS INC 2008010320080103184514184516184516 0 ";
  3.  
  4. st = Regex.Replace(st, @"[^\x20-\x7E]", "");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.