summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/Reaktor/sed-plugin.py
diff options
context:
space:
mode:
Diffstat (limited to 'makefu/2configs/Reaktor/sed-plugin.py')
-rw-r--r--makefu/2configs/Reaktor/sed-plugin.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/makefu/2configs/Reaktor/sed-plugin.py b/makefu/2configs/Reaktor/sed-plugin.py
index 6d6e1f8b8..677a1a44f 100644
--- a/makefu/2configs/Reaktor/sed-plugin.py
+++ b/makefu/2configs/Reaktor/sed-plugin.py
@@ -21,8 +21,8 @@ m = is_regex(line)
if m:
f,t,flagstr = m.groups()
- f = f.replace('\/','/')
- t = t.replace('\/','/')
+ fn = f.replace('\/','/')
+ tn = t.replace('\/','/')
flags = 0
count = 1
if flagstr:
@@ -30,10 +30,20 @@ if m:
flags = re.IGNORECASE
if 'g' in flagstr:
count = 0
+ else:
+ flagstr = ''
last = d.get(environ['_from'],None)
if last:
- print(f,t,last)
- print(re.sub(f,t,last,count=count,flags=flags))
+ print(fn,tn,last)
+ #print(re.sub(fn,tn,last,count=count,flags=flags))
+ from subprocess import Popen,PIPE
+ p = Popen(['sed','s/{}/{}/{}'.format(f,t,flagstr)],stdin=PIPE,stdout=PIPE )
+ so,_ = p.communicate(last+"\n")
+ if p.returncode:
+ print("something went wrong when trying to process your regex")
+ print(so)
+
+
else:
print("no last message")
else: