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
  • 39,665
  • 11
  • 104
  • 149
Ulrich
  • 157
  • 3

0 Answers0