Re: Off Topic: Slug regular expression

2007-11-01 Thread Jeremy Dunck
On 11/1/07, cjl <[EMAIL PROTECTED]> wrote: > > Do I need it if Django is already appending slashes? > No. Writing regular expressions is obviously something that can be done different ways. I think you should write your URLconfs expecting the slashes to be there so that you let Django append it

Re: Off Topic: Slug regular expression

2007-11-01 Thread cjl
Do I need it if Django is already appending slashes? --~--~-~--~~~---~--~~ 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

Re: Off Topic: Slug regular expression

2007-10-31 Thread Kristinn Örn Sigurðsson
It says the last slash is optional. On 11/1/07, cjl <[EMAIL PROTECTED]> wrote: > > > Thanks all. > > What is the second '?' for...I don't have it in my regular expression, > and it seems to be working fine. > -cjl > > > > > --~--~-~--~~~---~--~~ You received this m

Re: Off Topic: Slug regular expression

2007-10-31 Thread cjl
Thanks all. What is the second '?' for...I don't have it in my regular expression, and it seems to be working fine. -cjl --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Off Topic: Slug regular expression

2007-10-31 Thread Kenneth Gonsalves
On 01-Nov-07, at 7:41 AM, Kristinn Örn Sigurðsson wrote: > r'^accounts/(?P[\w\-]+)/?$' r'^accounts/(?P[\w-]+)/?$' works for me - no need to escape the '-' if it is at the end -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~-

Re: Off Topic: Slug regular expression

2007-10-31 Thread Kristinn Örn Sigurðsson
I'm just replying to the first post. I would write it as follows: r'^accounts/(?P[\w\-]+)/?$' On 11/1/07, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > > > > On 31-Oct-07, at 9:08 PM, cjl wrote: > > > Will these two regular expressions match the same strings? The both > > seem to work for me, bu

Re: Off Topic: Slug regular expression

2007-10-31 Thread Kenneth Gonsalves
On 31-Oct-07, at 9:08 PM, cjl wrote: > Will these two regular expressions match the same strings? The both > seem to work for me, but I couldn't find any information about the > importance of order between square brackets. dont put '-' between any letters in square brackets - to be on the saf

Re: Off Topic: Slug regular expression

2007-10-31 Thread Jeremy Dunck
On 10/31/07, cjl <[EMAIL PROTECTED]> wrote: ... > > > > Welcome to the transition between steps #1 and #2 ;) > > Actually, I think I'm still at step 0.5, the one where I wish someone > would post a library of frequently used Django URLconf regular > expressions, so I could 'borrow' them. > This i

Re: Off Topic: Slug regular expression

2007-10-31 Thread cjl
Thank you for the informative reply. > As you learn regular expressions, you'll go through a couple phases: > > 1) what the #$%^ is all this line-noise? > > 2) regexps rock! they'll solve any problem I throw at them! > > 3) regexps rock! I now know what types of problems the solve > well withou

Re: Off Topic: Slug regular expression

2007-10-31 Thread Tim Chase
>> Is there any difference between: >> >> r'^accounts/(?P[\w-]+)/$' >> >> and >> >> r'^accounts/(?P[-\w]+)/$' > > they match the same. To expand on Paul's answer, yes they're the same. The only time order matters is detailed at [1] where the character-set "[...]" notation is detailed. Namely

Re: Off Topic: Slug regular expression

2007-10-31 Thread Paul Rauch
On Wed, 31 Oct 2007 15:38:34 - cjl <[EMAIL PROTECTED]> wrote: > > I know next-to-nothing about regular expressions, so I apologize in > advance if my question is stupid. I am trying to match a slug field. > Is there any difference between: > > r'^accounts/(?P[\w-]+)/$' > > and > > r'^accou

Off Topic: Slug regular expression

2007-10-31 Thread cjl
I know next-to-nothing about regular expressions, so I apologize in advance if my question is stupid. I am trying to match a slug field. Is there any difference between: r'^accounts/(?P[\w-]+)/$' and r'^accounts/(?P[-\w]+)/$' Will these two regular expressions match the same strings? The both