PyMatch Tool.

Christian Gollwitzer auriocus at gmx.de
Mon Aug 18 13:38:54 EDT 2014


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



More information about the Python-list mailing list