Transform words into links with regex?

I’m recently doing a unit at college about web servers, my tutor has asked me to do a few online tutorials to understand how to do the basics. He told us to use the link below to start creating a wiki.
http://showmedo.com/videotutorials/video?name=11010&fromSeriesID=110

As you can see I’m on the 2nd video of the tutorial. However,I’m stuck.

You see the tutorial says to create a regex expression to transform words on the wiki to links.
The tutorial says to convert the NewPage text to a link to create a new page.

I followed the tutorial and get <a href=’/wikicamp/NewPage/’>NewPage</a> instead of a link.

My code used is:

from django import template
import re

wikilink = re.compile(“\b([A-Z][a-z]+[A-Z][a-z]+)…
register = template.Library()

@register.filter
def wikify(value):
return wikilink.sub(r”<a href=’/wikicamp/1/’>1</a>”, value)

from wikilink.py.

Is there away I can fix this to get the regex to work?

✅ Answers

? Best Answer

  • what is regex?
  • Leave a Comment