Match with regexp for flags to fix #1.