excluding search string in regular expressions

Franz Steinhaeusler franz.steinhaeusler at utanet.at
Fri Oct 22 10:35:36 CEST 2004


On Thu, 21 Oct 2004 15:32:37 +0200, "Diez B. Roggisch"
<deets.nospaaam at web.de> wrote:

>> 
>> A more common solution for detecting functions/Methods would be fine.
>
>Maybe you should go for a real parser here - together with a
>C-syntax-grammar. Trying to cram this stuff into regexps is bound for not
>catching special cases. And its gereally difficult to have a regexp _not_
>macht a certain word.
>

Hello Diez,

thanks, yes, it is difficult for "not" find a searchstring in regex ;)

I only want to find a regex for an editor (which is written in python) 
to have a common function (of course it cannot be so accurate as a
parser) to find a function/method defininition.

>Another approach would be to look for closing comments and function
>definitions in several rexes, and use python-logic:
>
>if doxy_close_rex.match(line):
>   line = lines.next()
>   if fun_def_rex.match(line):
>       ....

-- 
Franz Steinhaeusler



More information about the Python-list mailing list