[PyKDE] eric: do regular expressions work?
Parzival Herzog
parzp at shaw.ca
Mon Nov 1 02:29:35 GMT 2004
I have wrestled a lot with the eric3 search & replace regexps. Today
I was completely stumped by what seems to me to be a very simple task:
to find the text "time" or "localtime".
With the text:
--------------
def today(time=localtime):
''' datetime for midnight, today '''
tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday, tm_yday,
tm_isdst = time()
return date(tm_year, tm_mon, tm_mday)
--------------
Searching for "time", and "localtime", (separately, and not a regular
expression) finds these.
Searching for "time|localtime" (regular expression) finds nothing.
The eric regular expression syntax is not documented, so I
tried:
"(time)|(localtime)" (maybe alternation has higher precedence than
concatenation)
"\(time\)|\(localtime\)" (maybe meta-parentheses need to be escaped)
"time)\|localtime" (maybe alternation needs to be escaped)
They all failed to find "time" or "localtime" in the above text.
Is the regexp search broken, or is the syntax even weirder than what I tried?
Could you provide a summary of the regexp syntax (including valid references
for replacement text) used in eric?
Could you make the syntax more "normal", i.e. don't escape
parentheses for grouping, or more like (er exactly like!) the KDE text
editor component?
--
Parzival Herzog
More information about the PyQt
mailing list