Possible Duplicate:
Create regex from glob expression
We know that Bash doesn't use regular expressions for matching file names. For example:
*.dat
would match all file names with the dat extension. However, the same pattern in regular expression form would have been: .*\.dat
My question is how can I take a Bash-style pattern and translate it into a valid regular expression that would match the same file names.
For simplicity sake, let's ignore all sorts of Bash expansions and let's assume that Bash does not treat . .. and / separately.