You could potentially work around the regex misinterpretation issue by using some more complex combinations of grep and awk and so forth, but there's a better reason to not use getent | grep.
If /etc/nsswitch.conf is configured with a user or group database that doesn't support enumerating users (Hesiod, for instance, and probably LDAP under bad configurations), then the test will return false *negatives* and then try to create a user that already exists.
You could potentially work around the regex misinterpretation issue by using some more complex combinations of grep and awk and so forth, but there's a better reason to not use getent | grep.
If /etc/nsswitch.conf is configured with a user or group database that doesn't support enumerating users (Hesiod, for instance, and probably LDAP under bad configurations), then the test will return false *negatives* and then try to create a user that already exists.