Thanks for pointing this out. However, in the first link the regex is buried in some other code in one of the comments. This also wasn't even in the first page of results on google for me (google displays different results for different individuals). As for changing the search query to "validating if a string is hexadecimal" that's a good idea, although it doesn't account for "0x" and the 40 char length so could potentially give false positives.
Thanks for these, however, I was looking for a regular expression to use in my google forms for bounty submissions. I figured someone else could use this information.