in reply to hex-only regex

Regarding the second code snippet, it would probably be better to use a bare return; as a best practice, instead of return(0);. See Re^5: Elegant way to return true or nothing from a subroutine?. Cheers.