diff --git a/src/sbbs3/atcodes.cpp b/src/sbbs3/atcodes.cpp
index 7a8f296731fb04ea4cd55d7495e41dba5fb173cc..1e0416c89e3edfc1fcef450140b34cab1f78bfaf 100644
--- a/src/sbbs3/atcodes.cpp
+++ b/src/sbbs3/atcodes.cpp
@@ -126,12 +126,13 @@ int sbbs_t::show_atcode(const char *instr, JSObject* obj)
 	tp = strchr(str + 1, '@');
 	if (!tp)                 /* no terminating @ */
 		return 0;
-	sp = strchr(str + 1, ' ');
-	if (sp && sp < tp)         /* space before terminating @ */
-		return 0;
 	len = (tp - str) + 1;
 	(*tp) = 0;
 	sp = (str + 1);
+	if (IS_DIGIT(*sp)) // @-codes cannot start with a number
+		return 0;
+	if (strcspn(sp, " \t\r\n") != strlen(sp))  // white-space before terminating @
+		return 0;
 
 	if (*sp == '~' && *(sp + 1)) {   // Mouse hot-spot (hungry)
 		sp++;