LPS-44218  Avoid using Pattern.matches() whenever possible