qoobaa/vcard — pull request #5 by m1foley (2012-12-17 02:44:47+00:00)
Title: Regex refactor, includes date parsing fix

Cause of the date parsing bug:

All the regexs in the Bnf module are Strings that are later coerced into Regexps. The backslashes were not properly escaped here:

DATE = "(\d\d\d\d)-?(\d\d)-?(\d\d)"

Since this is a complicated and bug-prone way to deal with regexs, I decided to refactor:

- I changed all regexs in the Bnf module to be Regexps, not Strings.
- When the regexs were used outside the module, additional regex logic was usually added too (case sensitivity, whitespace, chaining them together). I centralized all regexp logic to be in the Bnf module, so the regexps can simply be used outside the module.