JAVA-062 / Advanced
Regular expression denial of service (ReDoS)
Why is this a problem?
Regular expressions with nested quantifiers occupy CPU on long input.
How to fix it
java
if (input.length() > 500) throw new IllegalArgumentException();
input.matches("^\\w+(?:\\s\\w+)*$");