import reprint( re.sub(r'^\W+|\W+$', '', '??cats--') )print( re.sub(r'^[\W_]+|[\W_]+$', '', '_??cats--_') )
Standard input is empty
cats cats
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!