Fix regular expressions for custom patterns.