On 10/16/07, Bogdan BOTEZ <[EMAIL PROTECTED]> wrote:
>
> On 10/16/07, MOROIANU Dragos <[EMAIL PROTECTED]> wrote:
> > Eu am incercat escape character si n-a mers asa cum ma
> > asteptam. Intrebarea mea era de ce trebuie sa pun 4
> > backslash-uri in loc de 2?
> >
>

Salut,
Stiu ca tu ai sed si bash si eu zic de python, dar e acelasi lucru

Din http://www.amk.ca/python/howto/regex/

Let's say you want to write a RE that matches the string "\section", which
might be found in a LATEX file. To figure out what to write in the program
code, start with the desired string to be matched. Next, you must escape any
backslashes and other metacharacters by preceding them with a backslash,
resulting in the string "\\section". The resulting string that must be
passed to re.compile() must be \\section. However, to express this as a
Python string literal, both backslashes must be escaped *again*.
In short, to match a literal backslash, one has to write '\\\\' as the RE
string, because the regular expression must be "\\", and each backslash must
be expressed as "\\" inside a regular Python string literal.
-- 
Andrei Dumitrescu
_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug

Raspunde prin e-mail lui