in reply to Finding C++ single inheritance occurrances
I am a little shaky how this regexp worksYAPE::Regex::Explain might help...
The regular expression: (?-imsx:(class|struct)\s+[^:{;]+:[\w<>\s]+{) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- class 'class' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- struct 'struct' ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- \s+ whitespace (\n, \r, \t, \f, and " ") (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- [^:{;]+ any character except: ':', '{', ';' (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- : ':' ---------------------------------------------------------------------- [\w<>\s]+ any character of: word characters (a-z, A- Z, 0-9, _), '<', '>', whitespace (\n, \r, \t, \f, and " ") (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- { '{' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
Typically, you would provide a LIST to grep, instead of a single scalar.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Finding C++ single inheritance occurrances
by ikegami (Patriarch) on May 18, 2011 at 17:36 UTC |