looking for a regular expression

Thomas Nelson thn at mail.utexas.edu
Tue Aug 1 09:58:49 EDT 2006


How about
my_string = "We the people of the United States, in order to form a
more perfect union, establish justice, insure domestic
tranquility,......"
print (x for x in my_string.split(",") if "justice" in x).next()

This isn't a regular expression, but it gives what you're looking for.

THN




More information about the Python-list mailing list