QT Development - Regular Expression

QT provide a class - QRegExp - to handle all process of Regular Expression. It's based on Perl syntax with some difference. After one hour of document reading, I think I should write down something to reference later.

Predefined Marco:
    MAX_INT: based on platform, but no less than 1024

Character Class
x : any character represent itself, unless it has a special regual expression meaning
/ x : a character that follows a backslash matches the character itself except where mentioned below
/a : BEL (0x07)
/f : FF(0x0c)
/n : LF (0x0a)
/r : CR (0x0d)
/t : horizontal tab
/v : vertical tab
/xhhhh : Unicode character corresponding to hexadecimal number hhhh (0 ~ FFFF)
/0ooo : ASCII/Latin-1 character corresponding to the octal number ooo (0 ~ 0377)
. : any character, including newline
/d : digit
/D : non-digit
/s : whitespace
/S : non-whitespace
/w : word
/W : non-word
/ n : n-th backreference, e.g. /1, /2, etc
/b: word boundary

Quantifier
? : zero or once
+ : once or more occurence
* : zero or more occurence

{n,m} : n <= occurence <= m
{n} : occurence = n
{n,} occurence at least n
{,m}: occurence at most m

Assertion
(?= x) : positive lookahead
(?! x) : negative lookahead

你可能感兴趣的:(QT Development - Regular Expression)