Le 21/04/05 16:19, « rbt » <[EMAIL PROTECTED]> a écrit :
> Peter Hansen wrote:
>> rbt wrote:
>>
>>> Output from 'netstat -b' on a win2003 server will show what binary is
>>> responsible for the connection. For example, it may list something
>>> like this along with other connection specific data:
[EMAIL PROTECTED] wrote:
> Beside rxb15, there is also redict, in the standard lib (Jay Graves
> shows the HD path):
> http://home.earthlink.net/~jasonrandharper/reverb.py
I knew there was a newer one out there but my google skills failed me.
Thanks for the link.
--
http://mail.python.org/mailma
Diez B. Roggisch>But as the world is complex and people want solutions
to their complex problems, IMHO programming will always be about such
nitty gritty details.<
REs are like assembly, but high-level languages show us that for a
mammal there are (often) better (higher) ways to program a computer
Simon Brunning wrote:
On 4/21/05, rbt <[EMAIL PROTECTED]> wrote:
string.between(data,[,])
def between(data, start, end):
return re.findall(re.escape(start) + r'([^]]*)'+ re.escape(end), data)
That's cool!
But it doesn't quite work if the end tag is not ']':
>>> import re
>>> def between(d
Fredrik Lundh wrote:
> Diez B. Roggisch wrote:
>
>> Welcome to the wonderful world of programming. Regular expressions are
>> what they are because they are modeled after a certain theory - that of
>> finite state automata and their correspondence to certain classes of
>> grammars.
>
> (except t
Paul McGuire wrote:
> Jay -
> Thanks for the pyparsing plug.
NP. pyparsing is on my list of stuff to play around with. I'm just
waiting for the proper problem to present itself.
> Here is how the OP's program would look using pyparsing:
And the exact reason that I could 'plug' pyparsing is tha
Jay -
Thanks for the pyparsing plug.
Here is how the OP's program would look using pyparsing:
import pyparsing
fp = file('filename')
data = fp.read()
fp.close()
foo = '''stuff [lsass.exe]
[System] more stuff
x [firefox.exe] ..
'''
LBRACK = pyparsing.Literal("[").suppress()
RBRACK
I haven't used either of these tools but they might help a little.
http://lfw.org/python/rxb15.py
http://pyparsing.sourceforge.net/
If you want to help building traditional regex patterns, I find
programs like these to be invaluable.
Tools/scripts/redemo.py in the python standard lib.
http://kod
On 4/21/05, rbt <[EMAIL PROTECTED]> wrote:
> string.between(data,[,])
def between(data, start, end):
return re.findall(re.escape(start) + r'([^]]*)'+ re.escape(end), data)
foo = '''stuff [lsass.exe]
[System] more stuff
x [firefox.exe] ..
'''
print between(foo, '[', ']')
--
C
Roy Smith wrote:
Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
Yes, it does... may take me a few minutes to get my head around it
though. Why do re's have to be so arcane and complicated... especially
in Python?
It's hard to preach 'ease of use' with stuff such as this in the
language. Perhaps one da
Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
>> Yes, it does... may take me a few minutes to get my head around it
>> though. Why do re's have to be so arcane and complicated... especially
>> in Python?
>>
>> It's hard to preach 'ease of use' with stuff such as this in the
>> language. Perhaps one
Diez B. Roggisch wrote:
Welcome to the wonderful world of programming. Regular expressions are what
they are because they are modeled after a certain theory - that of finite
state automata and their correspondence to certain classes of grammars.
(except that Python regexps are not always regular, o
> Yes, it does... may take me a few minutes to get my head around it
> though. Why do re's have to be so arcane and complicated... especially
> in Python?
>
> It's hard to preach 'ease of use' with stuff such as this in the
> language. Perhaps one day it can be rolled up into something that
> *rea
Peter Hansen wrote:
rbt wrote:
Output from 'netstat -b' on a win2003 server will show what binary is
responsible for the connection. For example, it may list something
like this along with other connection specific data:
[lsass.exe]
[System]
[firefox.exe]
[iexplorer.exe]
How might I process the
rbt wrote:
Output from 'netstat -b' on a win2003 server will show what binary is
responsible for the connection. For example, it may list something like
this along with other connection specific data:
[lsass.exe]
[System]
[firefox.exe]
[iexplorer.exe]
How might I process the output so that anyth
Output from 'netstat -b' on a win2003 server will show what binary is
responsible for the connection. For example, it may list something like
this along with other connection specific data:
[lsass.exe]
[System]
[firefox.exe]
[iexplorer.exe]
How might I process the output so that anything within
16 matches
Mail list logo