fork(6) download
  1. import re
  2. text = '(10 + 20) / (10 + 20)'
  3. test1 = re.findall(r'\(.*\)', text)
  4. test2 = re.findall(r'\(.+?\)', text)
  5.  
  6. for i in test1:
  7. print(i, end='')
  8. else:
  9. print()
  10.  
  11. for i in test2:
  12. print(i, end='')
  13. else:
  14. print()
Success #stdin #stdout 0.02s 9944KB
stdin
Standard input is empty
stdout
(10 + 20) / (10 + 20)
(10 + 20)(10 + 20)