Regular Expressions 101

Community Patterns

C++ Expression Match

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?'EXPR'(\+\+|--|\+|-|\*|\&|~|!)?\s*(((-?(?(?=0[xX])0[xX][\da-fA-F]+\.[\da-fA-F]|\d+\.\d*))|(-?(?(?=0)0(?(?=[xX]).[\da-fA-F']+|(?(?=[bB]).[01']+|[0-7']))|[\d']+))|('\\?.{1,4}')|((L|u8|u16|u32|(?:))"((\\\\)*\\"|[^"])*")|(R"(?'OPENING'.*)\(.*\)\g{OPENING}"))(\s*[\w$][\w\d$]*)?|[\w$][\w\d$]*(::[\w$][\w\d$]*)*)((\s*\+\+|--)|(\s*([+\-*\/%<>&|]|(\<\<|\>\>|\&\&|\|\|\<=|\>=|==|!=))\s*(?&EXPR))|(\(((?&EXPR)(\s*,\s*(?&EXPR))*)?\))|(\<((?&EXPR)(\s*,\s*(?&EXPR))*)?\>)|(\[(?&EXPR)\]))*)$
/
m

Description

Matches most expressions, doesn't match keywords like new or throw or lambdas.

Submitted by anonymous - 2 years ago (Last modified 2 years ago)