I'm not sure, but I think this should work - try it out and let us know.

r'^user/([\w\-+.@]+)/$'

I'm not too good with regexes, either. No one is. Also, characters like "+"
are encoded in URLs - so you might want to think of that.


On Sun, Apr 22, 2012 at 1:42 PM, Swaroop Shankar V <swaroo...@gmail.com>wrote:

> Hello All,
> I need some urgent help with this one. Am trying to show a user profile
> when the user navigates to a url of this format
>
> http://example.com/user/<username>
>
> I have provided the following expression in my urls.py file
>
> (r'^user/(\w+)/$','accounts.views.userProfile'),
>
> this working fine for normal usernames, but if the user add a . (dot) in
> between his username the url do not match with the regex and throws Page
> not found error.
>
> Since the django username supports  Letters, digits and @/./+/-/_  i want
> all these to be supported in my url. Could someone please help me to
> construct the url. Am pretty weak in regex and it will take me sometime to
> build a proper regex for the above url. Thanks
>
> Regards,
>
> Swaroop Shankar V
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Yati Sagade <http://twitter.com/yati_itay>

Twitter: @yati_itay <http://twitter.com/yati_itay>

Organizing member of TEDx EasternMetropolitanBypass
http://www.ted.com/tedx/events/4933
https://www.facebook.com/pages/TEDx-EasternMetropolitanBypass/337763226244869

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to