Subject: | Regular expressions have conditions too! |
Hello,
I've been using Devel::Cover for a few months now and I love it. It's made it *way* easier to write clean, bug-free code and unit tests.
One thing that just occured to me while writing a validator as a regular expression, is that regexp's have conditions too. I don't know how easy it would be to get this functionality in, but given a regular expression like:
qr/something|someotherthing/
I think it would be helpful to have coverage analysis showing you which parts of the regular expression got matched. With more complicated regular expressions, like
qr/(1|2|(456|654))|((?:(1|2)|(3|4))456(7|8))/
I could see the specification for what was matched and what wasn't getting really long (and it probably wouldn't be appropriate to use the same "A B C D" notation as standard code conditions).
What do you think? Is this feasable? Insane?
Thanks,
Tyler