AceCentre / aacnews

This is a small nodejs based app that manages public submissions of short news items that then gets published using a mailchimp campaign. An example of this is AACNews Monthly, managed by the Ace Centre.
https://aacinfo.email
1 stars 3 forks source link

regex for twitter needs updating #5

Closed willwade closed 9 years ago

willwade commented 9 years ago

if space in twitter then break the link.. e.g.:

@willwade (via Ian Hamilton on the games access list)

currently gets a href wrapping the whole line. It needs to break before the space (i.e. after willwade)

willwade commented 9 years ago

needs something like:

twitter_username_re = re.compile(?<=^|(?<=[^a-zA-Z0-9-\\.]))@([A-Za-z]+[A-Za-z0-9]+) my_html_str = twitter_username_re.sub(lambda m: '<a href="http://twitter.com/%s">%s</a>' % (m.group(1), m.group(0)), my_tweet)