Find all files with the extension .txt in the current directory and its subdirectories up to 4 levels deep and replace the regex with the replace string in each file.
find $(echo `pwd`) -mindepth 1 -maxdepth 4 -iname "*.txt" -type f -exec sed -i 's/regex/replace/g' {} \;