I can't be much help with changing the regex, but I believe the {1,3} {4} checks are so that any text of length 1-3 will be counted, and then if it's length 4 or longer it's only counted if it isn't starting with <!-- so that it doesn't catch the ID in your flashcards.