Thanks skittle, this will save me a lot of time.
I ended up using something like:
find . -type f -name '*.[hm]' -print0
| xargs -0 perl -pi -e 's/search_regex/replacement_string/g'
The only downside is that it updates the modification date for
all files searched, regardless of whether it modified them or not.