Bash Script Match Regex Javascript Function Syntax