QRegExp pattern("\\d{3}-\\d{2}-\\d{4}"); bool isValid = pattern.isValid(); // returns true
QRegExp pattern("([a-zA-Z]+)(\\d+)"); bool isValid = pattern.isValid(); // returns falseIn this example, we create a regular expression pattern for matching a string that starts with one or more letters, followed by one or more digits. However, we forgot to escape the backslash in the second capture group. Therefore, the pattern is invalid and the isValid function returns false. Package/library: Qt library