blag / pyp

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

something's wrong with relose rekeep, etc. #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
% ls *mp4 | pyp "p.rel('mp.')"       

What is the expected output? What do you see instead?

error: 'PypStr' object has no attribute 'rel' : p.rel('mp.')

What version of the product are you using? On what operating system?

#version 2.11

Please provide any additional information below.

I tried all kinds of variations (ie. relose, rekeep, rkeep, rlose, etc.) and 
the only one that works is p.re(<REGEXP).

Thanks!

Original issue reported on code.google.com by recko...@gmail.com on 5 May 2012 at 6:27

GoogleCodeExporter commented 9 years ago
Hi, these are actually functions, so you call them without the "p." like this:

pyp "rekeep('asdf')"...they are analogous to the keep and lose functions, which 
are similar to grep.

the p.re() works on an instance of p, and returns the matching string...so you 
can use multiple versions on the same line...so this is a more granular 
approach.

Hope that helps.

t

Original comment by tobyro...@gmail.com on 5 May 2012 at 6:34

GoogleCodeExporter commented 9 years ago

Original comment by tobyro...@gmail.com on 5 May 2012 at 6:55

GoogleCodeExporter commented 9 years ago
Thanks!

Are you planning to implement groups with p.re() so you can return match 
groupings within the regexp?

Original comment by recko...@gmail.com on 5 May 2012 at 7:07

GoogleCodeExporter commented 9 years ago
please try the beta, you can now supply an option arg to p.re()..like 
p.re(*7*,2) will pick out group 2.

t

Original comment by tobyro...@gmail.com on 2 Jun 2012 at 4:44

GoogleCodeExporter commented 9 years ago
works great!

Thanks!

Original comment by recko...@gmail.com on 3 Jun 2012 at 1:39