Re: [Tutor] RE module is working ?

2011-02-04 Thread Karim
By the way with your helper function algorithm Steven and Peter comments you made me think of this change: karim@Requiem4Dream:~$ echo 'prima " "' | sed -e 's/""/\\"\\"/g;s/\([^\]\)"/\1\\"/g' prima \" \" karim@Requiem4Dream:~$ echo 'prima ""' | sed -e 's/""/\\"\\"/g;s/\([^\]\)"/\1\\"/g' pr

Re: [Tutor] RE module is working ?

2011-02-04 Thread Karim
On 02/04/2011 11:26 AM, Peter Otten wrote: Karim wrote: That is not the thing I want. I want to escape any " which are not already escaped. The sed regex '/\([^\\]\)\?"/\1\\"/g' is exactly what I need (I have made regex on unix since 15 years). Can the backslash be escaped, too? If so I don't

Re: [Tutor] RE module is working ?

2011-02-04 Thread Karim
On 02/04/2011 02:36 AM, Steven D'Aprano wrote: Karim wrote: *Indeed what's the matter with RE module!?* You should really fix the problem with your email program first; Thunderbird issue with bold type (appears as stars) but I don't know how to fix it yet. A man when to a doctor and said, "

Re: [Tutor] RE module is working ?

2011-02-04 Thread Peter Otten
Karim wrote: > That is not the thing I want. I want to escape any " which are not > already escaped. > The sed regex '/\([^\\]\)\?"/\1\\"/g' is exactly what I need (I have > made regex on unix since 15 years). Can the backslash be escaped, too? If so I don't think your regex does what you think

Re: [Tutor] RE module is working ?

2011-02-04 Thread Peter Otten
Karim wrote: > Recall: > > >>> re.subn(r'([^\\])?"', r'\1\\"', expression) > > Traceback (most recent call last): > File "", line 1, in > File "/home/karim/build/python/install/lib/python2.7/re.py", line > 162, in subn >return _compile(pattern, flags).subn(repl, string, count)

Re: [Tutor] RE module is working ?

2011-02-03 Thread Steven D'Aprano
Karim wrote: *Indeed what's the matter with RE module!?* You should really fix the problem with your email program first; Thunderbird issue with bold type (appears as stars) but I don't know how to fix it yet. A man when to a doctor and said, "Doctor, every time I do this, it hurts. What sh

Re: [Tutor] RE module is working ?

2011-02-03 Thread Alan Gauld
"Karim" wrote Because expression = *' "" '* is in fact fact expression = ' "" '. The bold appear as stars I don't know why. Because in the days when email was always sent in plain ASCII text the way to show "bold" was to put asterisks around it. Underlining used _underscores_ like so...

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
On 02/03/2011 07:47 PM, Karim wrote: On 02/03/2011 02:15 PM, Peter Otten wrote: Karim wrote: I am trying to subsitute a '""' pattern in '\"\"' namely escape 2 consecutives double quotes: * *In Python interpreter:* $ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC 4.4.

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
On 02/03/2011 11:20 PM, Dave Angel wrote: On 01/-10/-28163 02:59 PM, Karim wrote: On 02/03/2011 02:15 PM, Peter Otten wrote: Karim wrote: (snip> *Indeed what's the matter with RE module!?* You should really fix the problem with your email program first; Thunderbird issue with bold type (ap

Re: [Tutor] RE module is working ?

2011-02-03 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Karim wrote: On 02/03/2011 02:15 PM, Peter Otten wrote: Karim wrote: (snip> *Indeed what's the matter with RE module!?* You should really fix the problem with your email program first; Thunderbird issue with bold type (appears as stars) but I don't know how to fix

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
On 02/03/2011 02:15 PM, Peter Otten wrote: Karim wrote: I am trying to subsitute a '""' pattern in '\"\"' namely escape 2 consecutives double quotes: * *In Python interpreter:* $ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC 4.4.3] on linux2 Type "help", "copyright",

Re: [Tutor] RE module is working ?

2011-02-03 Thread Peter Otten
Karim wrote: > I am trying to subsitute a '""' pattern in '\"\"' namely escape 2 > consecutives double quotes: > > * *In Python interpreter:* > > $ python > Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) > [GCC 4.4.3] on linux2 > Type "help", "copyright", "credits" or "license" for m

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
I forget something. There is no issue with python and double quotes. But I need to give it to TCL script but as TCL is shit string is only delimited by double quotes. Thus I need to escape it to not have syntax error whith nested double quotes. Regards The poor tradesman On 02/03/2011 12:45

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
Hello Steven, I am perhaps a poor tradesman but I have to blame my thunderbird tool :-P . Because expression = *' "" '* is in fact fact expression = ' "" '. The bold appear as stars I don't know why. I need to have escapes for passing it to another language (TCL interpreter). So I will rewrit

Re: [Tutor] RE module is working ?

2011-02-03 Thread Steven D'Aprano
Karim wrote: Hello, I am trying to subsitute a '""' pattern in '\"\"' namely escape 2 consecutives double quotes: You don't have to escape quotes. Just use the other sort of quote: >>> print '""' "" * *In Python interpreter:* $ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:5

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
Hello, Any news on this topic?O:-) Regards Karim On 02/02/2011 08:21 PM, Karim wrote: Hello, I am trying to subsitute a '""' pattern in '\"\"' namely escape 2 consecutives double quotes: * *In Python interpreter:* $ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC

[Tutor] RE module is working ?

2011-02-02 Thread Karim
Hello, I am trying to subsitute a '""' pattern in '\"\"' namely escape 2 consecutives double quotes: * *In Python interpreter:* $ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>