On Sun, Mar 18, 2012 at 23:46:17 +0100, suvayu ali <fatkasuvayu+linux@xxxxxxxxx> wrote:
I'm trying to write a regular expression that matches function and class definitions in C/C++ and defuns in lisp code. I intend to use it with sed and `git blame'. My first attempt relies on indentation. That obviously breaks rather often.
Mathematically, regular expressions can't match braces like this to an unbounded depth. You might be able to use extensions to common regular expression implementations that aren't strictly regular expressions to do this. It might be easier to write your own parser. There are tools, like flex and bison to help with this. -- users mailing list users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org