Re: RegExp problems

2016-03-09 Thread jorrit787
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

Re: RegExp problems

2016-03-08 Thread Michal Petrucha
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

RegExp problems

2016-03-07 Thread jorrit787
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