John S wrote:
> Not sure why you picked \A and \Z -- they are only useful if you are
> using the re.M flag.
Well, they're aliases for ^ and $ in "normal" mode, at least for strings
that don't end with a newline.
re.I is the same as re.IGNORECASE. More than one option may be OR'ed
together. T
On Jul 16, 9:38 am, Peng Yu <[EMAIL PROTECTED]> wrote:
> On Jul 15, 10:29 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
>
>
>
> > Peng Yu wrote:
> > > Hi,
>
> > > The following code snippet is from /usr/bin/rpl. I would like the it
> > > to match a word, for example, "abc" in ":abc:". But the current
Peng Yu wrote:
I didn't read the docs and tried the following code.
regex = re.compile(r"\A" + re.escape(old_str) + r"\Z",
opts.ignore_case and re.I or 0)
But I'm not sure why it is not working.
as the documentation says, \A and \Z matches at the beginning/end of a
*string*, not a word.
On Jul 15, 10:29 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
> Peng Yu wrote:
> > Hi,
>
> > The following code snippet is from /usr/bin/rpl. I would like the it
> > to match a word, for example, "abc" in ":abc:". But the current one
> > would not match "abc" in ":abc:". I tried to modify it myself.
Peng Yu wrote:
Hi,
The following code snippet is from /usr/bin/rpl. I would like the it
to match a word, for example, "abc" in ":abc:". But the current one
would not match "abc" in ":abc:". I tried to modify it myself. Would
you please let me know what is the corrected way to do it?
Thanks,
Pen
Hi,
The following code snippet is from /usr/bin/rpl. I would like the it
to match a word, for example, "abc" in ":abc:". But the current one
would not match "abc" in ":abc:". I tried to modify it myself. Would
you please let me know what is the corrected way to do it?
Thanks,
Peng
if opt