I have derived a grammar for the Regular Expression pattern syntax used by Qt’s QRegExp from its documentation. I’m sharing it here in case it turns out useful to somebody else. The grammar is licensed under the New BSD License. Similarity to the grammar described at TRE Regexp Syntax is not an accident.
expression = branch ("|" expression)
branch = atom (quantifier) (branch)
| assertion (branch)
atom = group
| "." // any-char class
| predef // predefined classes
| custom // custom classes
| "\\" [afnrtnv] // special char
| "\\" "x" [0-9a-fA-F]{4} // hex char
| "\\" "0" [0-7]{3} // oct char
| "\\" [1-9][0-9]* // back reference
| "\\" [^afnrtnvdDsSwWx0-9] // escaped char matching itself
| [^\\\\$()*+.?\\[\\]^{|}] // literal char matching itself
group = "(" expression ")"
| "(?:" expression ")"
predef = "\\" [dDsSwW]
custom = "[" ("^") custom2
custom2 = [^\\]-] custom3 // potential range start
| "\\]" custom3 // potential range start
| predef custom4
| "-" "]"
custom3 = "-" "\\]" custom4 // range complete
| "-" [^\\]-] custom4 // range complete
| predef custom4
| "-" "]"
| "]"
custom4 = [^\\]-] custom3 // potential range start
| "\\]" custom3 // potential range start
| predef custom4
| "-" "]"
| "]"
quantifier = "?"
| "+"
| "*"
| "{" (number) "," (number) "}"
number = [0-9]+
assertion = "(?=" expression ")"
| "(?!" expression ")"
| "^"
| "$"
| "\\b"
| "\\B"