make regex pattern non-greedy

The connect `.*~~` regex pattern matches other markup such `~~NOTOC~~`.