0

The following code will not work in python but works in testing applications like Jedit's plugin "regular expression tester":

import re
m = "text0 { \int_{0}^{1} f(s) \ds text } text2 {foo-abs2} text4  "
s = re.compile(r'\{[^{}]*(\{[^{}]*\}[^{}]*)*\}')
t = s.findall(m)
print(t) # gives ['{1} f(s) \\ds text ', '']
"""
Should gives back  
{ \int_{0}^{1} f(s) \ds text }
{foo-abs2}
""" 

What is wrong?

Aran-Fey
  • 35,525
  • 9
  • 94
  • 135
Ulrich
  • 117
  • 2

0 Answers0