On Tue, 06 May 2008 14:55:07 +, Raymond wrote:
>>Another approach is to use the split() function in "re" module.
>
> Ah ha, thar's the disconnect. Thanks for all the pointers, my def is
> now working. Still don't understand the logic behind this design
> though. I mean why would any program
> Ah ha, thar's the disconnect. Thanks for all the pointers, my def is
> now working. Still don't understand the logic behind this design though.
> I mean why would any programming language have separate search or find
> functions, one for regex and and another for non-regex based pattern
> match
Raymond wrote:
> My other gripe is with the kludgy object-oriented regex functions.
> Couldn't these be better implemented in-line? Why should I, as a coder,
> have to 're.compile()' when all the reference languages do this at compile
> time, from a much more straightforward and easy to read in-l
Raymond wrote:
Aren't sed, awk, grep, and perl the reference implementations of search
and replace?
I don't know about "reference implementations", but I daresay they are a
mess w.r.t. usability.
--
http://mail.python.org/mailman/listinfo/python-list
>Another approach is to use the split() function in "re" module.
Ah ha, thar's the disconnect. Thanks for all the pointers, my def is
now working. Still don't understand the logic behind this design though.
I mean why would any programming language have separate search or find
functions, one for
On Wed, 30 Apr 2008 17:12:15 +1000, Kam-Hung Soh <[EMAIL PROTECTED]>
wrote:
On Wed, 30 Apr 2008 15:27:36 +1000, Raymond <[EMAIL PROTECTED]>
wrote:
For some reason I'm unable to grok Python's string.replace() function.
Just trying to parse a simple IP address, wrapped in square brackets,
fr
On Wed, 30 Apr 2008 15:27:36 +1000, Raymond <[EMAIL PROTECTED]> wrote:
For some reason I'm unable to grok Python's string.replace() function.
Just trying to parse a simple IP address, wrapped in square brackets,
from Postfix logs. In sed this is straightforward given:
line = "date process text
Raymond wrote:
For some reason I'm unable to grok Python's string.replace() function.
Just trying to parse a simple IP address, wrapped in square brackets,
from Postfix logs. In sed this is straightforward given:
line = "date process text [ip] more text"
sed -e 's/^.*\[//' -e 's/].*$//'
a
On Apr 29, 11:27 pm, Raymond <[EMAIL PROTECTED]> wrote:
> For some reason I'm unable to grok Python's string.replace() function.
line = "abc"
line = line.replace("a", "x")
print line
--output:--
xbc
line = "abc"
line = line.replace("[apq]", "x")
print line
--output:--
abc
Does the 5 character
Hi,
2008/4/30 Raymond <[EMAIL PROTECTED]>:
> For some reason I'm unable to grok Python's string.replace() function.
replace() does not work with regular expressions.
> Is there a decent description of string.replace() somewhere?
Use re.sub().
>>> import re
>>> line = "date process text [ip] m
For some reason I'm unable to grok Python's string.replace() function.
Just trying to parse a simple IP address, wrapped in square brackets,
from Postfix logs. In sed this is straightforward given:
line = "date process text [ip] more text"
sed -e 's/^.*\[//' -e 's/].*$//'
yet the following Pyt
11 matches
Mail list logo