Regular expression quick reference . (period) - matches any single character except a newline. * (asterisk) - matches zero or more instances of the preceding character. + (plus) - matches one or more instances of the preceding character. ? (question mark) - matches zero or one (but not more) instances of the preceding character. \{n\} (backslash-braces) - matches exactly n repetitions of the preceding character. [ ... ] (brackets) - delimit a set of possible characters. ^ (caret) - matches the beginning-of-line character. $ (period) - matches the end-of-line character. Examples: 1. String: {\textit et al.} Search string: {\\textit.*} We match the whole thing. 2. M-x replace-regexp RET c[ad]+r RET \&-safe RET would replace (for example) `cadr' with `cadr-safe' and `cddr' with `cddr-safe'. 3. String: {\textit et al.} We want: {\textit {et al.}} Query: {\\textit\(.*\)} Replace it with: {\\textit {\1}} Final result: {\textit {et al.}} 4. String: cms.vuint32( 10, 10, 10, 10 ) [many different instances of this] We want: cms.vuint32( 10, 10, 10, 10, 0, 0, 0, 0, 0, 0 ) Query: cms.vuint32(\(.*\)) Replace it with: cms.vuint32(\1, 0, 0, 0, 0, 0, 0) Final result: cms.vuint32( 10, 10, 10, 10 , 0, 0, 0, 0, 0, 0)