[Tutor] REGEX EXPLANATION

Luke Paireepinart rabidpoobear at gmail.com
Wed Dec 22 04:38:34 CET 2010


Which part of the regexes do you not understand? Have you tried
figuring themselves out yourself first?
We don't typically give out answers here.  This is a tutor list, not a
solve your problems for you list.  We're here to teach you how to
fish, not cook for you.  So show us where you're stuck and we'll help
out.

Did you read the Python regex documentation online? I find it's quite
good.  Should give you a push in the right direction.

On Tue, Dec 21, 2010 at 9:10 AM,  <delegbede at dudupay.com> wrote:
> I have been reading regex in order to work around an assignment.
>
> Could anyone explain to me in plain english what the following regex expression translate to.
>
> (r'PSC(?P<observer_id>\d{6})(DC|VR)(\d{2})(RC|GA)(\d{3})(!?([A-Z\d]{1,})@?(.*))?', re.I)
>
> (r'PSC(?P<observer_id>\d{6})VR(?P<day>\d{2})RC(?P<location_id>\d{3})(?P<responses>[ABCDEFGHJKMNPQRSTUVWXYZ\d]{2,})?', re.I)
>
> (r'PSC(?P<observer_id>\d{6})VR(?P<day>\d{2})(?P<location_type>(RC|GA))(?P<location_id>\d{3})!(?P<responses>[ABCDEFGHJKMNPQ]{1,})@?(?P<comment>.*)', re.I)
>
> (r'PSC(?P<observer_id>\d{6})DC(?P<day>\d{2})RC(?P<location_id>\d{3})(?P<responses>[ABCDEFGHJKMNPQRSTUVWX\d]{2,})?', re.I)
>
> (r'PSC(?P<observer_id>\d{6})DC(?P<day>\d{2})(?P<location_type>(RC|GA))(?P<location_id>\d{3})!(?P<responses>[ABCDEFGHJK]{1,})@?(?P<comment>.*)', re.I)
>
> Like reading it out in plain english. This should further help me understand how these signs work and then I can get along.
>
> Thanks.
> Sent from my BlackBerry wireless device from MTN
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list