Re: PyMatch Tool.

2014-08-18 Thread Rafael Francischini
Em sexta-feira, 15 de agosto de 2014 17h59min28s UTC-3, Christian Gollwitzer  
escreveu:
 Am 14.08.14 21:50, schrieb rafinha.u...@gmail.com:
 
  Hello, I created this tool to help me develop on formatting text using 
  regular expressions.
 
  Any questions, I am available.
 
  Thank you.
 
 
 
  Tool - https://github.com/rfunix/PyMatch
 
 
 
 I expected something like visual regexp:
 
 
 
   http://laurent.riesterer.free.fr/regexp/
 
 
 
 Since RegExp-Syntax is very similar across tools, yours is almost 
 
 identical to grep. Is it not?
 
 
 
   Christian

Hi Christian, it is quite similar. 
The difference is with her can extract and use the values stored in groups.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyMatch Tool.

2014-08-18 Thread Christian Gollwitzer

Am 18.08.14 14:21, schrieb Rafael Francischini:

Em sexta-feira, 15 de agosto de 2014 17h59min28s UTC-3, Christian Gollwitzer  
escreveu:


I expected something like visual regexp:
http://laurent.riesterer.free.fr/regexp/

Since RegExp-Syntax is very similar across tools, yours is almost

identical to grep. Is it not?



Christian


Hi Christian, it is quite similar.
The difference is with her can extract and use the values stored in groups.



I guess you haven't tried visual regexp. It marks the regexp parts and 
what it matches with distinct colors - Look at the screenshot. The 
C++-code looks like syntax highlighting. But visual regexp does the 
coloring automatically just by looking at the regexp. For example, the 
word template is colored blue, because it was matched by \w+ (also 
colored blue in the expression).


Your tool seems to only extract pure text. This can be done using sed, e.g.:

sed 's/(.* some re)/place \1 here/'

The \1 is replaced with the first () group, \2 with the second etc. From 
within Python, you can use re.sub, which also accepts backreferences.


Christian
--
https://mail.python.org/mailman/listinfo/python-list


Re: PyMatch Tool.

2014-08-18 Thread Rafael Francischini
Cristian you are right, never experienced visual regexp, is incredible. 
I created pyMatch to help me in the automation scripts and text formatting, so 
I decided to work from the command line. 
You're right, you can also do this with sed, but sed has a small defect in my 
view, you will be able to use a maximum of 10 groups in it and  also the 
visual regexp. 

If you want to read more: 
http://stackoverflow.com/questions/10992650/how-to-get-10th-grouping-value-in-sed
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyMatch Tool.

2014-08-15 Thread Christian Gollwitzer

Am 14.08.14 21:50, schrieb rafinha.u...@gmail.com:

Hello, I created this tool to help me develop on formatting text using regular 
expressions.
Any questions, I am available.
Thank you.

Tool - https://github.com/rfunix/PyMatch


I expected something like visual regexp:

http://laurent.riesterer.free.fr/regexp/

Since RegExp-Syntax is very similar across tools, yours is almost 
identical to grep. Is it not?


Christian
--
https://mail.python.org/mailman/listinfo/python-list


PyMatch Tool.

2014-08-14 Thread rafinha . unix
Hello, I created this tool to help me develop on formatting text using regular 
expressions. 
Any questions, I am available. 
Thank you.

Tool - https://github.com/rfunix/PyMatch
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyMatch Tool.

2014-08-14 Thread Chris Angelico
On Fri, Aug 15, 2014 at 5:50 AM,  rafinha.u...@gmail.com wrote:
 Hello, I created this tool to help me develop on formatting text using 
 regular expressions.
 Any questions, I am available.
 Thank you.

 Tool - https://github.com/rfunix/PyMatch

How is this better than GNU sed?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyMatch Tool.

2014-08-14 Thread Skip Montanaro
On Thu, Aug 14, 2014 at 5:49 PM, Chris Angelico ros...@gmail.com wrote:

  Tool - https://github.com/rfunix/PyMatch

 How is this better than GNU sed?

I didn't look closely at the program, but I have an idea how I might use it.

Back in the dawn of Internet time (before Y2K, Django, V8, etc) I
developed and maintained a concert calendar website. It had a database
of tour dates, and a bunch of handwritten HTML. And, I allowed people
to describe their concert tour information in a
slightly-higher-than-regex level (SLTRL). This facility allowed me to
routinely process known tour date listings and update my listings with
little, if any, manual intervention.  Under the covers, of course, it
used regular expressions. I had, as they say, two problems.

My solution to failed matches (I was actually the heaviest user of the
system) was to provide a textarea where you could paste in some tour
dates as they appeared on an artist's website, then enter the SLTRL
notation you thought described the dates. Most of the time things were
pretty easy to handle, but every now and then it would fail. I would
then start lopping of chunks of the SLTRL from the right and see if
anything now matched, and if so, what was leftover.

This tool might work in a similar fashion. Run it repeatedly on the
same input with ever-more-complex patterns and groups until it matches
everything. Then you're done and you paste the ugly mess into your
code.

Then you have two problems. wink

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list