Regular expression

Back9 backgoodoo at gmail.com
Tue May 18 10:32:54 EDT 2010


On May 18, 10:09 am, ilvecchio <terenzio.be... at gmail.com> wrote:
> 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

I mean the result should be like this:
0x345A9BBA



More information about the Python-list mailing list