Regular Expression to match Parenthesis ( {} ), Brackets ( (),[] )
Please someone provide me code for matching parenthesis and Brackets using regular expressions.
Re: Regular Expression to match Parenthesis ( {} ), Brackets ( (),[] )
Is this some kind of school assignment ? There is another thread about this here : link .
Re: Regular Expression to match Parenthesis ( {} ), Brackets ( (),[] )
I had tried these codes but they are not working..
functionFormat1.setFontItalic(false);
functionFormat1.setForeground(Qt::green);
rule.pattern = QRegExp("[([^\]]+)]");
rule.format = functionFormat1;
highlightingRules.append(rule);
functionFormat1.setFontItalic(false);
functionFormat1.setForeground(Qt::green);
rule.pattern = QRegExp("\\b{([^}]+)}");
rule.format = functionFormat1;
highlightingRules.append(rule);
functionFormat1.setFontItalic(false);
functionFormat1.setForeground(Qt::green);
rule.pattern = QRegExp("\\b{[^}]*}");
rule.pattern = QRegExp("\\(([^)]+)\)");
rule.format = functionFormat1;
highlightingRules.append(rule);
and i tried this one also for parenthesis , but this again not working :
rule.pattern = QRegExp("\\b{[^}]*}");