Regular expression

ilvecchio terenzio.berni at gmail.com
Tue May 18 10:09:48 EDT 2010


On May 18, 3:48 pm, Back9 <backgoo... at gmail.com> wrote:
>  Hi,
>
> I have a string like this:
> 0x340x5A0x9B0xBA
> I want to extract 0x from the string but the first one.
>
> How I can use re for this case?
>
> The string size will vary.
>
> TIA

Maybe the easy way is something like this:

m = re.match('(0x)(.*)','0x340x5A0x9B0xBA')
m.groups()[1]

Terenzio



More information about the Python-list mailing list