Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20388 > unrolled thread
| Started by | Devin Jeanpierre <jeanpierreda@gmail.com> |
|---|---|
| First post | 2012-02-13 23:38 -0500 |
| Last post | 2012-02-14 08:33 -0500 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.python
re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ? Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-13 23:38 -0500
Re: re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ? Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2012-02-14 05:20 -0800
Re: re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ? Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-14 08:33 -0500
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
|---|---|
| Date | 2012-02-13 23:38 -0500 |
| Subject | re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ? |
| Message-ID | <mailman.5792.1329194327.27778.python-list@python.org> |
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
[toc] | [next] | [standalone]
| From | Vinay Sajip <vinay_sajip@yahoo.co.uk> |
|---|---|
| Date | 2012-02-14 05:20 -0800 |
| Message-ID | <0cc200e6-6e4c-47b7-8563-3abc3ac94f22@k10g2000yqk.googlegroups.com> |
| In reply to | #20388 |
On Feb 14, 4:38 am, Devin Jeanpierre <jeanpierr...@gmail.com> 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
[toc] | [prev] | [next] | [standalone]
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
|---|---|
| Date | 2012-02-14 08:33 -0500 |
| Message-ID | <mailman.5798.1329226436.27778.python-list@python.org> |
| In reply to | #20396 |
On Tue, Feb 14, 2012 at 8:20 AM, Vinay Sajip <vinay_sajip@yahoo.co.uk> 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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web