in reply to Re^2: Basic regex to parse source code
in thread Basic regex to parse source code

In your regex, you do not have to escape the comma and your (.+) will slurp everything up to the last ] in your line, which is definitely not what you want. You only need the characters up to the next ', so the (negated) character class [^']+ will do what you want.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James