esainane / pyp

Automatically exported from code.google.com/p/pyp
0 stars 0 forks source link

Feature request: p.findall #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I just started trying out pyp and one feature that I was very surprised to find 
missing was a wrapper around re.findall. Currently, there doesn't seem to be an 
easy way of getting all instances of a match of a regular expression, and that 
would be really nice for combining with p.kill.

Original issue reported on code.google.com by dan.blan...@gmail.com on 4 Jun 2012 at 7:54

GoogleCodeExporter commented 8 years ago
I apologize for reporting this as a defect, but I couldn't seem to find a way 
to report it as anything else.

Original comment by dan.blan...@gmail.com on 4 Jun 2012 at 7:55

GoogleCodeExporter commented 8 years ago
sounds interesting...we'll add this feature when we get a chance.

t

Original comment by tobyro...@gmail.com on 6 Jun 2012 at 6:06

GoogleCodeExporter commented 8 years ago
I might add a p.rekill(REGEX) and p.rereplace(REGEX) instead...can you think of 
other ways the matches might be useful?

thanks,

t

Original comment by tobyro...@gmail.com on 5 Sep 2012 at 6:51

GoogleCodeExporter commented 8 years ago
Providing a p.findall(REGEX) would let you do things like extract every email 
address on a line as a list (which you could then process with a list 
comprehension however you wanted). I think it would be extremely useful.

I think p.rekill and p.rereplace would be extremely useful for cases where you 
want to modify subsections of the line while leaving the rest intact, but 
p.findall would be a nice flexible solution for when you only want to keep the 
parts of the line that match the regex and operate solely on those.

Original comment by dan.blan...@gmail.com on 5 Sep 2012 at 7:06

GoogleCodeExporter commented 8 years ago
we've added these functions. this was an excellent suggestion, thank you!

http://code.google.com/p/pyp/

Original comment by tobyro...@gmail.com on 26 Mar 2014 at 9:56