Regular Expression of QT

Source: Internet
Author: User

Qregexp is a regular expression class of QT.
Qt has two regular expressions of different classes.
The first class is metacharacters. It represents one or more constant expressions.
The first class is an escape character, which represents a special character.
 
1. metacharacters
. Match any single character. For example, 1.3 may be 1. Followed by any character, followed by 3
^ Match the first character string. For example, ^ 12 may be 123, but not 312.
$ Matches the end of a string. For example, 12 $ can be 312, and cannot be 123
[] Match any character entered in brackets. [123] can be 1, 2, or 3
* Match any number of leading characters. For example, 1*2 can be any number of 1 (not even), followed by 2
+ Match at least one leading character. For example, 1 + 2 must be one or more 1, followed by a 2
? Matches a leading character or is empty. For example, 1? 2 can be 1 or 12
 
Ii. Unified Configuration Mode
Qregexp: setpatternsyntax (qregexp: wildcard); you can set metacharacters to the unified mode. In the unified mode, only three metacharacters are available. Their functions remain unchanged.
? Match any single character, for example, 1? 2 can be 1, followed by any single character, followed by 2
* Match any character sequence. For example, 1*2 can be 1, followed by any number of characters, followed by 2
[] Matches a defined Character Set combination. for example, [A-Za-z/.] it can match any character and. [^ A] matches characters other than lowercase.
 
Iii. Escape Sequence
/. Match "."
/^ Match "^"
/$ Match "$"
/[Match "["
/] Match "]"
/* Match "*"
/+ Match "+"
/? Match "? "
/B matches the bell character to make the computer beep.
/T tabulation symbol
/N newline characters
/R carriage return
/S arbitrary space
/Xnn matches the hexadecimal NN characters
/0nn matches 8-digit NN characters
These expressions start with "/" and are the same as the escape characters of C ++. to define an escape sequence in qregexp,
You need to add two //

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.