import re
text = '{"mob":"1154098431","type":"user","allowOrder":false,"prev":1}'
newstring = '"allowOrder":true,"'
#newstring = '"mob":"nonblocked",'
reg = '"allowOrder":(.*?),"|"mob":"(.*?)",'
r = re.compile(reg,re.DOTALL)
result = r.sub(newstring, text)
print (result)
im trying to matching and replacing multiple regex patterns with exact values can someone help me to achieve this