Your improvements work great, thank you. And thank you for the very
detailed explanations!
On Tuesday, March 8, 2016 at 9:41:11 AM UTC+1, Michal Petrucha wrote:
>
> On Mon, Mar 07, 2016 at 05:44:08PM -0800, jorr...@gmail.com
> wrote:
> > I'm trying to replace *[URL]www.link.com[/URL]* with
On Mon, Mar 07, 2016 at 05:44:08PM -0800, jorrit...@gmail.com wrote:
> I'm trying to replace *[URL]www.link.com[/URL]* with HTML with this regexp:
>
> topic.text = re.sub("(\[URL\])(.*)(\[\/URL\])", '$2', topic
> .text, flags=re.I)
>
> But it's giving me the following problems:
>
>1. The $2
I'm trying to replace *[URL]www.link.com[/URL]* with HTML with this regexp:
topic.text = re.sub("(\[URL\])(.*)(\[\/URL\])", '$2', topic
.text, flags=re.I)
But it's giving me the following problems:
1. The $2 capture group is only able to be repeated once, so I get
$2
instead of
3 matches
Mail list logo