Skip to content

Instantly share code, notes, and snippets.

@5up3rman
Last active August 30, 2017 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 5up3rman/546a0bb29cc40acbb4b5bf3e59de991f to your computer and use it in GitHub Desktop.
Save 5up3rman/546a0bb29cc40acbb4b5bf3e59de991f to your computer and use it in GitHub Desktop.
Flawed Item Renaming - Really Basic Regex
static void Main(string[] args)
{
var wildItemName = "<strong>Name of a Product<sup>™</sup>Version 1</strong>";
var notEntirelyFixed =
Regex.Replace(wildItemName, @"[^0-9a-zA-Z]+", " ").Trim();
Console.WriteLine(notEntirelyFixed);
Console.ReadKey();
// Result: strong Name of a Product sup sup Version 1 strong
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment