I am on a closed network (i.e. no connectivity to the internet).
I have a bourne shell script that asks for the user to enter a regular expression for use with
Generally speaking, I like to do some form of input validation.
Is there a way to test a string variable to see if it is a (valid) regex?
(Copying things from the internet onto my system can be done, but it takes forever and is a PITA -- thus I am looking for way to do it natively.)
Bourne-again shell, and is far more featureful than the Bourne shell
grepalready isn't a native a part of your shell, but an external tool. Granted, it's a standard one, and so likely to be found anywhere, but then again e.g. Debian-based systems always have Perl too, so what tools you have really depends on the system. If you're on Linux, you likely have either Bash or some smaller POSIX-only shell, like Dash or Busybox, not an ancient Bourne shell. (Note the bourne-shell tag has the description "a historical implementation of /bin/sh")