Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I write text files in the MoinMoin Wiki markup language in a text editor (emacs). When I mis-place one of the special tags my whole page gets mangled with the wrong formatting -- or worse. I always close a formatting element on the same line where I opened it.

Can I use gnu grep to find mismatching Wiki-tags on a line? Like:

  • << macroname ( params ) >>
  • backtick code backtick
  • '' double quotes for italics '' -- probably difficult
  • ''' triple quotes for bold ''' -- probably difficult

I normally do not nest tags. So there is no "bold code" or "bold italics".

share|improve this question
up vote 1 down vote accepted

No in general. grep is line oriented tools and regex is less powered then context free gramma. If you try write:

grep -v '<<[^>]>>' <file

you miss in match:

<<good>>  <<bad>d>

But you already use Emacs and some checks already included:

M-x check-parens RET!

If you read you can learn that writing parser for MoinMoin is hard task.

share|improve this answer

Your Answer


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.