I have a string of this kind of type:
import re
s = 'T [90] Call: proof(([temp(p∨q∨r), p, ¬q], [])⊢q, _41226, _41228, proof{ \
-5: ["assumptions([p,¬q,p∨q∨r])","premisses_origin([q,¬q])","premisses_no_origin([])","premisses_exc_origin([])","conclusion([q∧ ¬q])","rule([∧I])","d0(([temp(p∨q∨r),p,¬q],[])⊢(q∧ ¬q))","d1(([temp(p∨q∨r),p,¬q],[])⊢q∧([temp(p∨q∨r),p,¬q],[q])⊢(¬q))","step(9)"] \
\
-4: ["assumptions([p,¬q,p∨q∨r])","premisses_origin([¬q,q∧ ¬q])","premisses_no_origin([])","premisses_exc_origin([¬q])","conclusion([q])","rule([¬E])","d0(([temp(p∨q∨r),p],[])⊢q)","d1(([temp(p∨q∨r),p,¬q],[])⊢(q∧ ¬q))","step(8)"]\
\
-3: ["assumptions([p,p∨q∨r])","premisses_origin([q])","premisses_no_origin([])","premisses_exc_origin([])","conclusion([q∨p∨r])","rule([∨I])","d0(([temp(p∨q∨r),p],[])⊢(q∨p∨r))","d1(([temp(p∨q∨r),p],[])⊢q)","step(6)"]\
\
-2: ["assumptions([p,p∨q∨r])","premisses_origin([q∨p∨r])","premisses_no_origin([])","premisses_exc_origin([p])","conclusion([p→q∨p∨r])","rule([→I])","d0(([temp(p∨q∨r)],[])⊢(p→q∨p∨r))","d1(([temp(p∨q∨r),p],[])⊢(q∨p∨r))","step(5)"]\
\
-1: ["assumptions([p∨q∨r])","premisses_origin([p→q∨p∨r,q∨r→q∨p∨r])","premisses_no_origin([])","premisses_exc_origin([])","conclusion([(p→q∨p∨r)∧(q∨r→q∨p∨r)])","rule([∧I])","d0(([temp(p∨q∨r)],[])⊢((p→q∨p∨r)∧(q∨r→q∨p∨r)))","d1(([temp(p∨q∨r)],[])⊢(p→q∨p∨r)∧([temp(p∨q∨r)],[p→q∨p∨r])⊢(q∨r→q∨p∨r))","step(3)"]\
\
0: ["assumptions([p∨q∨r])","premisses_origin([p∨q∨r,(p→q∨p∨r)∧(q∨r→q∨p∨r)])","premisses_no_origin([])","premisses_exc_origin([])","conclusion([q∨p∨r])","rule([∨E])","d0(([p∨q∨r],[])⊢(q∨p∨r))","d1(([temp(p∨q∨r)],[])⊢((p→q∨p∨r)∧(q∨r→q∨p∨r)))","step(2)"]\
\
1: ["p∨q∨r","step(1)"]\
\
2: ["p","step(4)"]\
\
3: ["¬q","step(7)"]\
\
}, _41204, _41234)\
T [90] Fail: proof(([temp(p∨q∨r), p, ¬q], [])⊢q, _41226, _41228, proof{\
-5: ["assumptions([p,¬q,p∨q∨r])","premisses_origin([q,¬q])","premisses_no_origin([])","premisses_exc_origin([])","conclusion([q∧ ¬q])","rule([∧I])","d0(([temp(p∨q∨r),p,¬q],[])⊢(q∧ ¬q))","d1(([temp(p∨q∨r),p,¬q],[])⊢q∧([temp(p∨q∨r),p,¬q],[q])⊢(¬q))","step(9)"]\
\
-4: ["assumptions([p,¬q,p∨q∨r])","premisses_origin([¬q,q∧ ¬q])","premisses_no_origin([])","premisses_exc_origin([¬q])","conclusion([q])","rule([¬E])","d0(([temp(p∨q∨r),p],[])⊢q)","d1(([temp(p∨q∨r),p,¬q],[])⊢(q∧ ¬q))","step(8)"]\
\
-3: ["assumptions([p,p∨q∨r])","premisses_origin([q])","premisses_no_origin([])","premisses_exc_origin([])","conclusion([q∨p∨r])","rule([∨I])","d0(([temp(p∨q∨r),p],[])⊢(q∨p∨r))","d1(([temp(p∨q∨r),p],[])⊢q)","step(6)"]\
\
-2: ["assumptions([p,p∨q∨r])","premisses_origin([q∨p∨r])","premisses_no_origin([])","premisses_exc_origin([p])","conclusion([p→q∨p∨r])","rule([→I])","d0(([temp(p∨q∨r)],[])⊢(p→q∨p∨r))","d1(([temp(p∨q∨r),p],[])⊢(q∨p∨r))","step(5)"]\
\
-1: ["assumptions([p∨q∨r])","premisses_origin([p→q∨p∨r,q∨r→q∨p∨r])","premisses_no_origin([])","premisses_exc_origin([])","conclusion([(p→q∨p∨r)∧(q∨r→q∨p∨r)])","rule([∧I])","d0(([temp(p∨q∨r)],[])⊢((p→q∨p∨r)∧(q∨r→q∨p∨r)))","d1(([temp(p∨q∨r)],[])⊢(p→q∨p∨r)∧([temp(p∨q∨r)],[p→q∨p∨r])⊢(q∨r→q∨p∨r))","step(3)"]\
\
0: ["assumptions([p∨q∨r])","premisses_origin([p∨q∨r,(p→q∨p∨r)∧(q∨r→q∨p∨r)])","premisses_no_origin([])","premisses_exc_origin([])","conclusion([q∨p∨r])","rule([∨E])","d0(([p∨q∨r],[])⊢(q∨p∨r))","d1(([temp(p∨q∨r)],[])⊢((p→q∨p∨r)∧(q∨r→q∨p∨r)))","step(2)"]\
\
1: ["p∨q∨r","step(1)"]\
\
2: ["p","step(4)"]\
\
3: ["¬q","step(7)"]\
\
}, _41204, _41234)\
T [81] Fail: proof(([temp(p∨q∨r), p, ¬q], [])⊢q∧([temp(p∨q∨r), p, ¬q], [q])⊢(¬q), _38484, _38486, proof{\
-5: ["assumptions([p,¬q,p∨q∨r])","premisses_origin([q,¬q])","premisses_no_origin([])","premisses_exc_origin([])","conclusion([q∧ ¬q])","rule([∧I])","d0(([temp(p∨q∨r),p,¬q],[])⊢(q∧ ¬q))","d1(([temp(p∨q∨r),p,¬q],[])⊢q∧([temp(p∨q∨r),p,¬q],[q])⊢(¬q))","step(9)"]\
\
-4: ["assumptions([p,¬q,p∨q∨r])","premisses_origin([¬q,q∧ ¬q])","premisses_no_origin([])","premisses_exc_origin([¬q])","conclusion([q])","rule([¬E])","d0(([temp(p∨q∨r),p],[])⊢q)","d1(([temp(p∨q∨r),p,¬q],[])⊢(q∧ ¬q))","step(8)"]\
\
-3: ["assumptions([p,p∨q∨r])","premisses_origin([q])","premisses_no_origin([])","premisses_exc_origin([])","conclusion([q∨p∨r])","rule([∨I])","d0(([temp(p∨q∨r),p],[])⊢(q∨p∨r))","d1(([temp(p∨q∨r),p],[])⊢q)","step(6)"]\
\
-2: ["assumptions([p,p∨q∨r])","premisses_origin([q∨p∨r])","premisses_no_origin([])","premisses_exc_origin([p])","conclusion([p→q∨p∨r])","rule([→I])","d0(([temp(p∨q∨r)],[])⊢(p→q∨p∨r))","d1(([temp(p∨q∨r),p],[])⊢(q∨p∨r))","step(5)"]\
\
-1: ["assumptions([p∨q∨r])","premisses_origin([p→q∨p∨r,q∨r→q∨p∨r])","premisses_no_origin([])","premisses_exc_origin([])","conclusion([(p→q∨p∨r)∧(q∨r→q∨p∨r)])","rule([∧I])","d0(([temp(p∨q∨r)],[])⊢((p→q∨p∨r)∧(q∨r→q∨p∨r)))","d1(([temp(p∨q∨r)],[])⊢(p→q∨p∨r)∧([temp(p∨q∨r)],[p→q∨p∨r])⊢(q∨r→q∨p∨r))","step(3)"]\
\
0: ["assumptions([p∨q∨r])","premisses_origin([p∨q∨r,(p→q∨p∨r)∧(q∨r→q∨p∨r)])","premisses_no_origin([])","premisses_exc_origin([])","conclusion([q∨p∨r])","rule([∨E])","d0(([p∨q∨r],[])⊢(q∨p∨r))","d1(([temp(p∨q∨r)],[])⊢((p→q∨p∨r)∧(q∨r→q∨p∨r)))","step(2)"]\
\
1: ["p∨q∨r","step(1)"]\
\
2: ["p","step(4)"]\
\
3: ["¬q","step(7)"]\
\
}, _31664, 0)'
my aim now is to remove all substrings starting with proof{
and ending with }
such that the aim output is something like that:
result = 'T [90] Call: proof(([temp(p∨q∨r), p, ¬q], [])⊢q, _41226, _41228, , _41204, _41234)\
T [90] Fail: proof(([temp(p∨q∨r), p, ¬q], [])⊢q, _41226, _41228, , _41204, _41234)\
T [81] Fail: proof(([temp(p∨q∨r), p, ¬q], [])⊢q∧([temp(p∨q∨r), p, ¬q], [q])⊢(¬q), _38484, _38486, , _31664, 0)'
Based on a similar question I tried something like that:
start = re.escape("proof{")
end = re.escape("}")
result = re.search('%s(.*)%s' % (start, end), s).group(1)
but it doesn't do what I want.
CodePudding user response:
I think I found it:
re.sub("proof{.*?}",'', s)