[cnn] Improve regexes and fix test