I think this'll be equivalent:
```regex
var shortHex = /([a-f\d]){3}/i;
```

Since at this point we know it's a length of 3 it has to match exactly so no need for begin/end of line (unless that improves perf).