Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have been given some code written by a developer that could not spell to save his life.

For example, in the OUTPUT of the program, he has spelled the word 'circular' as both "Circual" and "circiual", and the word 'following' as 'follwing' (not to mention all the typos in the code and comments).

I want to clean up some of the typos in the code, but since some of the spelling is inconsistent, it wouldn't be easy to find all variants of misspellings of the word.

Does there exist a fuzzy search tool (such as a plugin for Notepad++ or vim) I could use to look for substrings that are similar to 'circular'? A simple spell-check tool wouldn't work (it's code -- the word 'circular' could appear in part of a variable name).

share|improve this question
    
What IDE are you using right now? –  Brad Jul 20 '12 at 16:16
    
@Brad I am using Notepad++ (editor), but I am familiar with many others (including vim, eclipse, Visual Studio). –  Darthfett Jul 20 '12 at 16:21
    
How much 'extra' information is in the word names, e.g. are we talking nCircular or much more, e.g. nCircularMotion? –  snowdude Aug 7 '12 at 13:14
    
@snowdude If 'Circular' appears in the word it should match it. –  Darthfett Aug 7 '12 at 14:50

1 Answer 1

Visual Studio (and I'm sure others hopefully NP++ which I have not used) allows you to search/find and replace using Regular Expressions. You can make them pretty fuzzy.

I like to test out my Regex on this site before using it in code. http://regexpal.com/

i.e. use circ(\S){0,4} to find

  • "Circual"
  • "circular"
  • "circiual"

then use "circular" as your replace term.

share|improve this answer
    
Notepad++ definitely has regex, so this could work as a general-purpose solution. I was hoping that I might be able to avoid thinking too much about each word though (e.g. what happens if he misspells it 'cricular': c[irua]{1,3}c[irual]{1,5}). –  Darthfett Jul 20 '12 at 16:35
    
yeah...sounds like a pretty crappy problem to have! Regex can help and generally make it easier but you're right, it won't catch the worst spelling mistakes. This is my only idea other than spending a day or two going through the project. Maybe someone else will have more insight. –  Brad Jul 20 '12 at 16:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.