P
Peng Yu
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 opts.whole_words:
regex = re.compile(r"(??<=\s)|^)" + re.escape(old_str) + r"(?=\s|
$)",
opts.ignore_case and re.I or 0)
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 opts.whole_words:
regex = re.compile(r"(??<=\s)|^)" + re.escape(old_str) + r"(?=\s|
$)",
opts.ignore_case and re.I or 0)