django 'urlize' strings form tect just like twitter
- by dana
heyy there
i want to parse a text,let's name it 'post', and 'urlize' some strings if they contain a particular character, in a particular position.
my 'pseudocode' trial would look like that:
def urlize(post)
for string in post
if string icontains ('#')
url=(r'^searchn/$',
searchn,
name='news_searchn'),
then apply url to the string
return urlize(post)
i want the function to return to me the post with the urlized strings, where necessary (just like twitter does).
i don't understand: how can i parse a text, and search for certain strings?
is there ok to make a function especially for 'urlizing' some strings? The function should return the entire post, no matter if it has such kind of strings.
is there another way Django offers?
Thank you