convert format to use regex replace for shebangs

indexOf will parse the entire string for `#1` while regex for beginning of string will fail-short if first chars don't match.

- Performance boost (more than 50% on large strings)
- Cleaner syntax