Regular expressions question
Neil Cerutti
horpner at yahoo.com
Tue Jan 16 09:40:55 EST 2007
On 2007-01-16, Victor Polukcht <vpolukcht at gmail.com> wrote:
> Actually, i'm trying to get the values of first field (Global) , fourth
> (200, 4), and fifth (100%) and sixth (100%).
>
> Everything except fourth is simple.
>>> g = "Global etsi3 * 4 ok 30 100% 100% Outgoing"
>>> import re
>>> r = re.search('\*\s+(\d+)', g)
>>> r.group()
'* 4'
>>> r.group(1)
'4'
--
Neil Cerutti
We're not afraid of challenges. It's like we always say: If you want to go out
in the rain, be prepared to get burned. --Brazillian soccer player
More information about the Python-list
mailing list