nsapurchase.blogg.se

Regular expression not substring
Regular expression not substring




regular expression not substring

In particular, the pattern syntax can be set to QRegExp::FixedString, which means the pattern to be matched is interpreted as a plain string, i.e., special characters (e.g., backslash) are not escaped.Ī good text on regexps is Mastering Regular Expressions (Third Edition) by Jeffrey E.

regular expression not substring

The syntax rules used by QRegExp can be changed with setPatternSyntax(). QRegExp can also be used in a simpler, wildcard mode that is similar to the functionality found in command shells. QRegExp is modeled on Perl's regexp language. splitting tab-delimited strings.Ī brief introduction to regexps is presented, a description of Qt's regexp language, some examples, and the function documentation itself. Ī regexp can be used to identify where a string should be split apart, e.g. is an integer or contains no whitespace.Ī regexp provides more powerful pattern matching than simple substring matching, e.g., match one of the words mail, letter or correspondence, but none of the words email, mailman, mailer, letterbox, etc.Ī regexp can replace all occurrences of a substring with a different substring, e.g., replace all occurrences of & with & except where the & is already followed by an amp. SetPatternSyntax(QRegExp::PatternSyntax syntax)Ī regexp can test whether a substring meets some criteria, e.g. SetCaseSensitivity(Qt::CaseSensitivity cs) LastIndexIn(const QString & str, int offset = -1, QRegExp::CaretMode caretMode = CaretAtZero) const IndexIn(const QString & str, int offset = 0, QRegExp::CaretMode caretMode = CaretAtZero) const QRegExp(const QString & pattern, Qt::CaseSensitivity cs = Qt::CaseSensitive, QRegExp::PatternSyntax syntax = RegExp)






Regular expression not substring