Mosè Giordano <m...@gnu.org> writes: > 2015-11-24 21:13 GMT+01:00 Arash Esbati <esb...@gmx.de>: >> >> Mosè Giordano <m...@gnu.org> writes: >> >>> Probably yes: so you want to match the whole \declaretheoremstyle >>> macro, but saving only the mandatory argument, right? >> >> Yes, exactly. > > The problem of your regex is that will match *everything* until the > last closing bracket. This is good when you test your regex in a > simple case, but will fail in a real document with other commands > taking optional and mandatory arguments.
Thanks for your response. Your are right, I missed that completely. > Is the non paired "]" in > > anothername = {valu-es[]}]{} , > > intended? No, it was just part of the experiment. > If so, I don't have a solution at hand, otherwise, if you're sure you > have always paired brackets, you can use something like > > > "\\\\declaresomething\\[\\(?:[^][]*\\(?:\\[[^][]*\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\][^][]*\\)*\\][^][]*\\)*\\)\\][ > \t\n\r]*{[ \t\n\r]*\\(.*\\)[ \t\n\r]*}" The existence of brackets is not guaranteed, it is the optional argument. I will play around with your suggestion; I have to decode it first ;-) Best, Arash _______________________________________________ auctex-devel mailing list auctex-devel@gnu.org https://lists.gnu.org/mailman/listinfo/auctex-devel