Advertisement
Guest User

Jython re problem

a guest
Apr 26th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. retest.py:
  2. ----------
  3. import re
  4.  
  5. m=re.search(r'name=(.+)', 'name=test')
  6.  
  7. if m and m.groups > 0:
  8. print m.group(1)
  9. ----------
  10. % ~/jython2.5.3b1/bin/jython retest2.py
  11. test
  12.  
  13. % ~/jython2.5.3b1/bin/jython -m py_compile retest2.py
  14.  
  15. java -cp ~/jython2.5.3b1/jython.jar:. retest2\$py
  16.  
  17. Exception in thread "main" Traceback (most recent call last):
  18. File "retest2$py", line 3, in <module>
  19. File "/home/joel/jython2.5.3b1/Lib/re.py", line 188, in compile
  20. return _compile(pattern, flags)
  21. File "/home/joel/jython2.5.3b1/Lib/re.py", line 239, in _compile
  22. p = sre_compile.compile(pattern, flags)
  23. File "/home/joel/jython2.5.3b1/Lib/re.py", line 239, in _compile
  24. p = sre_compile.compile(pattern, flags)
  25. File "/home/joel/jython2.5.3b1/Lib/sre_compile.py", line 512, in compile
  26. p = sre_parse.parse(p, flags)
  27. File "/home/joel/jython2.5.3b1/Lib/sre_parse.py", line 679, in parse
  28. p = _parse_sub(source, pattern, 0)
  29. File "/home/joel/jython2.5.3b1/Lib/sre_parse.py", line 314, in _parse_sub
  30. itemsappend(_parse(source, state))
  31. File "/home/joel/jython2.5.3b1/Lib/sre_parse.py", line 534, in _parse
  32. if sourcematch("?"):
  33. File "/home/joel/jython2.5.3b1/Lib/sre_parse.py", line 202, in match
  34. if char == self.next:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement