Skip to content

Regex to the Rescue!!

I’m in the process of writing up documents on my research, it was tedious at first, now i’m growing a fond for it, specially with better tools. Eye ball norms may be helpful, however for some things you may need a magnifying glass to observe :). I’ve found that regex can be useful in this area as well. Normally regex comes up in programming problems, and i was lucky enough to get introduced to this concept in a project involving writing a Kernel for IPython , there of course to interpret commands given to the kernel one needs to process thoroughly in order to pass along to the supporting client.

Long story short, thinking pro-grammatically (please bear with my writing) you can use this this Swiss army knife in your text editors rather than your pro-grams  😀 !

Some regex commands:

Find  double  spaces, finding them makes my eyes hurt alotttt!!! yes you can search for double space regularly however searching for those inside your latex source you may get dozens of unnecessary results inside your tables or includegraphics snippets. This tiny guy finds spaces between two words for you easily:

 \w[ ]{2,}\w

Find inadvertently Capitalized words in the middle of sentences. “Where is your ‘notepad search’ now? 😀

 ([a-zA-Z]+)\s([A-Z][a-z]*)\s([a-zA-Z]+)

These are the sources of this two really nice regex, try finding/creating more useful ones, to make writing your documents much more fun! and of course please let me know about them as well 🙂

Double Space , Capitalized words