Fix #501.  Add support for 'n' flag in substitution to count matches
without performing actual substitution.