/usr/share/kde4/apps/tables/scripts/functions/pyregexp.py is in calligrasheets 1:2.4.0-0ubuntu2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #!/usr/bin/env kross
import re, Kross, KSpread
func = KSpread.function("PYREGEXP")
func.minparam = 3
func.maxparam = 3
func.comment = "The PYREGEXP() function displays the current datetime."
func.syntax = "PYREGEXP(string)"
func.addParameter("String", "The input string.")
func.addParameter("String", "The regular expression.")
func.addParameter("String", "Replace with.")
func.addExample("PYREGEXP(\"Some String\",\"(S|m)\",\"A\")")
def update(args):
s = args[0]
regexp = args[1]
repl = args[2]
try:
p = re.compile(regexp)
func.result = p.sub(repl, s)
except:
func.error = "Invalid regexp"
func.connect("called(QVariantList)", update)
func.registerFunction()
|