[Tutor] really basic py/regex

An Liu sourceonly at gmail.com
Sat Mar 31 01:44:58 EDT 2018


On Fri, 30 Mar 2018 at 12:03 bruce <badouglas at gmail.com> wrote:

> Hi.
>
> Trying to quickly get the re.match(....)  to extract the groups from the
> string.
>
> x="MATH 59900/40 [47490] - THE "
>
> The regex has to return MATH, 59900, 40,, and 47490
>
> d=re.match(r'(\D+)...) gets the MATH...


did you look into d.group(0) if d existed?

>
>
> But I can't see (yet) how to get the rest of what I need...
>
> Pointers would be useful.
>
> Thanks
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
-- 
Liu An
Institution of modern physics, Shanghai, China


More information about the Tutor mailing list