diff --git a/src/utils.c b/src/utils.c
index 8ad9a83d581efb5eca828503c4738ea8db1c740f..602e7a2159e4bc7d720708d547358f2348294cc8 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -48,6 +48,7 @@ int regexp_bol_or_eol(const regex_t *preg, const char *string)
 {
     return (regexec(preg, string, 0, NULL, 0) == 0 &&
 	regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
+	REG_NOMATCH);
 }
 #endif /* HAVE_REGEX_H */