in reply to using ? and ?? in regex

You're using ? in the shell wildcard sense to mean "any character"; unfortunately, that's not what it means in a regular expression. See perldoc perlre for a list of all the metacharacters. You probably want . instead.

hdp.