MinimalMaximizer
MinimalMaximizer

Reputation: 392

Python RegEX that gets each name of a function in a file

Trying to implement a regex script that gets the name of each function and returns them to a text file. The returning to text file part I got, the part I need some pointers in I don't.

# I just want to extract "name_i_want"
def name_i_want(self):

Upvotes: 1

Views: 47

Answers (1)

Bryan Elliott
Bryan Elliott

Reputation: 4095

A regex for this could be:

(?<=def )(\w+)(?=\()

Working regex example:

http://regex101.com/r/qR3fE7

Upvotes: 2

Related Questions