I was trying to use Python's re (regular expressions) module to parse
a log file, but when I ran the following example from the Python
documentation, I realized he was not working as expected. Is there
something here that I do not know?

joao@Hades:~$ sage --python
Python 2.7.8 (default, Aug 10 2014, 17:23:10)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
>>> m.group(0)
'Isaac Newton'
>>>
joao@Hades:~$ sage
┌────────────────────────────────────────────────────────────────────┐
│ Sage Version 6.3, Release Date: 2014-08-10                         │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
sage: import re
sage: m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
sage: m.group(0)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-3-5e8fcb82d2b1> in <module>()
----> 1 m.group(Integer(0))

IndexError: no such group

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to