Correct regex patterns used in gsub statements