Tuesday, November 30, 2010

Add spaces to PascalCase text using VS

  1. In Visual Studio open Find and Replace
  2. Find what = "{[A-Z]}" (exclude " characters)
  3. Replace with " \1" (note space before \1)
  4. Check Match case and Use RegEx
  5. Done
Useful for correcting text documents copied from a PDF export that have lost spacing.

If some words (e.g. and) are not initially capitalised, fix these using:
  1. Find what = "{[a-z]}and"
  2. Replace with "\1 and"