Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > re module: Nothing to repeat, but no sre_constants.error: nothing torepeat ?

Reply
Thread Tools

re module: Nothing to repeat, but no sre_constants.error: nothing torepeat ?

 
 
Devin Jeanpierre
Guest
Posts: n/a
 
      02-14-2012
Hey Pythonistas,

Consider the regular expression "$*". Compilation fails with the
exception, "sre_constants.error: nothing to repeat".

Consider the regular expression "(?=$)*". As far as I know it is
equivalent. It does not fail to compile.

Why the inconsistency? What's going on here?

-- Devin
 
Reply With Quote
 
 
 
 
Vinay Sajip
Guest
Posts: n/a
 
      02-14-2012
On Feb 14, 4:38*am, Devin Jeanpierre <(E-Mail Removed)> wrote:
> Hey Pythonistas,
>
> Consider the regular expression "$*". Compilation fails with the
> exception, "sre_constants.error: nothing to repeat".
>
> Consider the regular expression "(?=$)*". As far as I know it is
> equivalent. It does not fail to compile.
>
> Why the inconsistency? What's going on here?
>
> -- Devin


$ is a meta character for regular expressions. Use '\$*', which does
compile.

Regards,

Vinay Sajip
 
Reply With Quote
 
 
 
 
Devin Jeanpierre
Guest
Posts: n/a
 
      02-14-2012
On Tue, Feb 14, 2012 at 8:20 AM, Vinay Sajip <(E-Mail Removed)> wrote:
> $ is a meta character for regular expressions. Use '\$*', which does
> compile.


I mean for it to be a meta-character.

I'm wondering why it's OK for to repeat a zero-width match if it is a
zero-width assertion.

-- Devin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I know nothing about Java but is this possible Pete Java 2 03-09-2006 07:36 AM
HttpURLConnection - works with '.html' but nothing else, why? junk1@davidbevan.co.uk Java 1 03-07-2006 02:29 AM
SQLConnection.Open() Timeout Error - but...nothing has changed? Nevyn Twyll ASP .Net 4 03-19-2005 01:38 AM
Problem in executing a script on the server side ! Script found but nothing executed ! CÚdric RossÚ ASP .Net 1 11-09-2004 09:43 AM



Advertisments