The most obvious way to prevent ReDoS attacks would be to avoid using regex for user input validation. Unfortunately, for most applications, this is not a practical solution.
A more realistic mitigation mechanism is to build non-vulnerable expressions. When writing regex, closely review and analyze all patterns before implementation to ensure they do not contain any evil regex patterns.