[issue18155] csv.Sniffer.has_header doesn't escape characters used in regex

2013-06-07 Thread Vajrasky Kok
Changes by Vajrasky Kok sky@speaklikeaking.com: Removed file: http://bugs.python.org/file30498/csv_has_header.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18155 ___

[issue18155] csv.Sniffer.has_header doesn't escape characters used in regex

2013-06-07 Thread Vajrasky Kok
Vajrasky Kok added the comment: Attached the patch to fix the problem. -- keywords: +patch nosy: +vajrasky Added file: http://bugs.python.org/file30498/csv_has_header.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18155

[issue18155] csv.Sniffer.has_header doesn't escape characters used in regex

2013-06-07 Thread Vajrasky Kok
Vajrasky Kok added the comment: Sorry. This one is correct. Attached the patch to fix the problem. -- Added file: http://bugs.python.org/file30499/csv_has_header.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18155

[issue18155] csv.Sniffer.has_header doesn't escape characters used in regex

2013-06-07 Thread Vajrasky Kok
Changes by Vajrasky Kok sky@speaklikeaking.com: Removed file: http://bugs.python.org/file30499/csv_has_header.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18155 ___

[issue18155] csv.Sniffer.has_header doesn't escape characters used in regex

2013-06-07 Thread Vajrasky Kok
Vajrasky Kok added the comment: Added test to sniffer double quote. -- Added file: http://bugs.python.org/file30501/csv_has_header.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18155

Using re.VERBOSE, and re-using components of regex?

2013-04-16 Thread Victor Hooi
Hi, I'm trying to compile a regex Python with the re.VERBOSE flag (so that I can add some friendly comments). However, the issue is, I normally use constants to define re-usable bits of the regex - however, these doesn't get interpreted inside the triple quotes. For example: import re

Re: Using re.VERBOSE, and re-using components of regex?

2013-04-16 Thread MRAB
On 17/04/2013 00:45, Victor Hooi wrote: Hi, I'm trying to compile a regex Python with the re.VERBOSE flag (so that I can add some friendly comments). However, the issue is, I normally use constants to define re-usable bits of the regex - however, these doesn't get interpreted inside

[issue17341] Poor error message when compiling invalid regex

2013-04-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 65db865c0851 by R David Murray in branch '3.3': #17341: Include name in re error message about invalid group name. http://hg.python.org/cpython/rev/65db865c0851 New changeset 227fed7a05d4 by R David Murray in branch 'default': Merge #17341: Include

[issue17341] Poor error message when compiling invalid regex

2013-04-14 Thread R. David Murray
R. David Murray added the comment: Thanks Jason. -- resolution: - fixed stage: - committed/rejected status: open - closed versions: +Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17341

[issue17341] Poor error message when compiling invalid regex

2013-04-13 Thread Jason Michalski
Changes by Jason Michalski arm...@armooo.net: -- keywords: +patch Added file: http://bugs.python.org/file29802/cpython-3.3-17341.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17341 ___

[issue17341] Poor error message when compiling invalid regex

2013-04-13 Thread Jason Michalski
Changes by Jason Michalski arm...@armooo.net: Added file: http://bugs.python.org/file29803/cpython-2.7-17341.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17341 ___

Re: Doing both regex match and assignment within a If loop?

2013-03-29 Thread Steven D'Aprano
I'm trying to avoid is this: if expression1.match(line): results = expression1.match(line) which I assume would call the regex match against the line twice Correct. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Doing both regex match and assignment within a If loop?

2013-03-29 Thread Peter Otten
, is there a Pythonic way to tackle this? What I'm trying to avoid is this: if expression1.match(line): results = expression1.match(line) which I assume would call the regex match against the line twice - and when I'm dealing with a huge amount of log lines, slow things down. (1

Re: Doing both regex match and assignment within a If loop?

2013-03-29 Thread Alain Ketterlin
Victor Hooi victorh...@gmail.com writes: expression1 = re.compile(r'') expression2 = re.compile(r'') [...] Just a quick remark: regular expressions are pretty powerful at representing alternatives. You could just stick everything inside a single re, as in '...|...' Then use

Re: Doing both regex match and assignment within a If loop?

2013-03-29 Thread Arnaud Delobelle
On Friday, 29 March 2013, Alain Ketterlin wrote: Victor Hooi victorh...@gmail.com javascript:; writes: expression1 = re.compile(r'') expression2 = re.compile(r'') [...] Just a quick remark: regular expressions are pretty powerful at representing alternatives. You could

Re: Doing both regex match and assignment within a If loop?

2013-03-29 Thread Neil Cerutti
A regex avoider, so take it with a small chunk of sodium. Is it possible to somehow test for a match, as well as do assignment of the re match object to a variable? One way to attack this problem that's not yet been explicitly mentioned is to match using a generator function: def match_each(s

Re: Doing both regex match and assignment within a If loop?

2013-03-29 Thread Mitya Sirenef
On 03/29/2013 04:27 AM, Peter Otten wrote: (2) import re class Matcher: def __call__(self, expr, line): result = self.match = expr.match(line) return result def __getattr__(self, name): return getattr(self.match, name) Perhaps it's a little simpler to

Doing both regex match and assignment within a If loop?

2013-03-28 Thread Victor Hooi
I'm trying to avoid is this: if expression1.match(line): results = expression1.match(line) which I assume would call the regex match against the line twice - and when I'm dealing with a huge amount of log lines, slow things down. Cheers, Victor -- http://mail.python.org/mailman

Re: Doing both regex match and assignment within a If loop?

2013-03-28 Thread Chris Rebert
()... AFAIK, not without hacks and/or being unidiomatic. Obviously the above won't work - however, is there a Pythonic way to tackle this? What I'm trying to avoid is this: if expression1.match(line): results = expression1.match(line) which I assume would call the regex match

[issue17544] regex code re-raises exceptions on success

2013-03-26 Thread Zdeněk Pavlas
Zdeněk Pavlas added the comment: Yes, found that *certain* IO operations re-raise the error, too. However, if the Python runtime expects extension writers to keep tstate-curexc_type clear, it should be documented in http://docs.python.org/2/c-api/exceptions.html There's not a single use

[issue17544] regex code re-raises exceptions on success

2013-03-25 Thread Zdeněk Pavlas
code, do some I/O.. everything runs fine. 3. run a regexp match, or import the re module. TypeError is raised. -- components: Regular Expressions messages: 185205 nosy: Zdeněk.Pavlas, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: regex code re-raises

[issue17544] regex code re-raises exceptions on success

2013-03-25 Thread Ezio Melotti
Ezio Melotti added the comment: Can you provide an actual example to reproduce the error? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17544 ___

[issue17544] regex code re-raises exceptions on success

2013-03-25 Thread Zdeněk Pavlas
Zdeněk Pavlas added the comment: static PyObject* foo(PyObject *, PyObject *arg) { void *buf; Py_ssize_t size; if (PyObject_AsReadBuffer(arg, buf, size)) size = -1; return PyInt_FromLong(size); } import tst, re re.search(a, a) _sre.SRE_Match object at 0xb76d0950

[issue17544] regex code re-raises exceptions on success

2013-03-25 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: The returned value and the global indicator are not independent. C functions should not set an error while returning a valid value. The same behavior will occur in random places -- for example, for x in range(2): pass also triggers the issue, this is

[issue17341] Poor error message when compiling invalid regex

2013-03-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue14462. It will be easier to include a full group name than an invalid character. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17341

[issue17341] Poor error message when compiling invalid regex

2013-03-03 Thread Roy Smith
status: open title: Poor error message when compiling invalid regex type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17341

[issue17341] Poor error message when compiling invalid regex

2013-03-03 Thread R. David Murray
R. David Murray added the comment: The error is that '' is not legal in a group name, and the parser is parsing the P= form. The error message could be improved by including the bad character in the message. -- keywords: +easy nosy: +r.david.murray

Re: Curious to see alternate approach on a search/replace via regex

2013-02-15 Thread Serhiy Storchaka
On 08.02.13 03:08, Ian Kelly wrote: I think what we're seeing here is that the time needed to look up the compiled regular expression in the cache is a significant fraction of the time needed to actually execute it. There is a bug issue for this. See http://bugs.python.org/issue16389 . --

Re: Curious to see alternate approach on a search/replace via regex

2013-02-08 Thread Ian Kelly
to look up the compiled regular expression in the cache is a significant fraction of the time needed to actually execute it. By actually execute you mean to apply the compiled expression to the search or sub? Or do you mean the time needed to compile the pattern into a regex obj? The former

Re: Curious to see alternate approach on a search/replace via regex

2013-02-08 Thread Nick Mellor
Hi RH, It's essential to know about regex, of course, but often there's a better, easier-to-read way to do things in Python. One of Python's aims is clarity and ease of reading. Regex is complex, potentially inefficient and hard to read (as well as being the only reasonable way to do things

Re: Curious to see alternate approach on a search/replace via regex

2013-02-08 Thread Peter Otten
Serhiy Storchaka wrote: On 07.02.13 11:49, Peter Otten wrote: ILLEGAL = -:./?= try: TRANS = string.maketrans(ILLEGAL, _ * len(ILLEGAL)) except AttributeError: # python 3 TRANS = dict.fromkeys(map(ord, ILLEGAL), _) str.maketrans() D'oh. ILLEGAL = -:./?= try:

Re: Curious to see alternate approach on a search/replace via regex

2013-02-08 Thread Steven D'Aprano
into a regex obj? The former. Both are dwarfed by the time needed to compile the pattern. Surely that depends on the size of the pattern, and the size of the data being worked on. Compiling the pattern s[ai]t doesn't take that much work, it's only six characters and very simple. Applying it to: sazsid

Re: Curious to see alternate approach on a search/replace via regex

2013-02-08 Thread Ian Kelly
On Fri, Feb 8, 2013 at 4:43 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Ian Kelly wrote: Surely that depends on the size of the pattern, and the size of the data being worked on. Natually. Compiling the pattern s[ai]t doesn't take that much work, it's only six characters

Re: Curious to see alternate approach on a search/replace via regex

2013-02-07 Thread Peter Otten
rh wrote: I am curious to know if others would have done this differently. And if so how so? This converts a url to a more easily managed filename, stripping the http protocol off. This: http://alongnameofasite1234567.com/q?sports=runa=1b=1 becomes this:

Re: Curious to see alternate approach on a search/replace via regex

2013-02-07 Thread jmfauth
On 7 fév, 04:04, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 06 Feb 2013 13:55:58 -0800, Demian Brecht wrote: Well, an alternative /could/ be: ... py s = 'http://alongnameofasite1234567.com/q?sports=runa=1b=1' py assert u2f(s) == mangle(s) py py from timeit import

Re: Curious to see alternate approach on a search/replace via regex

2013-02-07 Thread Chris Angelico
On Thu, Feb 7, 2013 at 10:08 PM, jmfauth wxjmfa...@gmail.com wrote: The future is bright for ... ascii users. jmf So you're admitting to being not very bright? *ducks* Seriously jmf, please don't hijack threads just to whine about contrived issues of Unicode performance yet again. That horse

Re: Curious to see alternate approach on a search/replace via regex

2013-02-07 Thread Nick Mellor
Hi RH, translate methods might be faster (and a little easier to read) for your use case. Just precompute and re-use the translation table punct_flatten. Note that the translate method has changed somewhat for Python 3 due to the separation of text from bytes. The is a Python 3 version. from

Re: Curious to see alternate approach on a search/replace via regex

2013-02-07 Thread Demian Brecht
On 2013-02-06 7:04 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I dispute those results. I think you are mostly measuring the time to print the result, and I/O is quite slow. Good call, hadn't even considered that. My tests show that using urlparse is 33% faster than using

Re: Curious to see alternate approach on a search/replace via regex

2013-02-07 Thread Serhiy Storchaka
On 07.02.13 11:49, Peter Otten wrote: ILLEGAL = -:./?= try: TRANS = string.maketrans(ILLEGAL, _ * len(ILLEGAL)) except AttributeError: # python 3 TRANS = dict.fromkeys(map(ord, ILLEGAL), _) str.maketrans() -- http://mail.python.org/mailman/listinfo/python-list

Re: Curious to see alternate approach on a search/replace via regex

2013-02-07 Thread Steven D'Aprano
rh wrote: I am using 2.7.3 and I put the re.compile outside the function and it performed faster than urlparse. I don't print out the data. I find that hard to believe. re.compile caches its results, so except for the very first time it is called, it is very fast -- basically a function call

Re: Curious to see alternate approach on a search/replace via regex

2013-02-07 Thread Steven D'Aprano
rh wrote: On Fri, 08 Feb 2013 09:45:41 +1100 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: rh wrote: I am using 2.7.3 and I put the re.compile outside the function and it performed faster than urlparse. I don't print out the data. I find that hard to believe.

Re: Curious to see alternate approach on a search/replace via regex

2013-02-07 Thread Ian Kelly
On Thu, Feb 7, 2013 at 5:55 PM, Ian Kelly ian.g.ke...@gmail.com wrote: Whatever caching is being done by re.compile, that's still a 24% savings by moving the compile calls into the setup. On the other hand, if you add an re.purge() call to the start of t1 to clear the cache: t3 = Timer( ...

Re: Curious to see alternate approach on a search/replace via regex

2013-02-07 Thread Steven D'Aprano
Ian Kelly wrote: On Thu, Feb 7, 2013 at 4:59 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Oh, one last thing... pulling out re.compile outside of the function does absolutely nothing. You don't even compile anything. It basically looks up that a compile function exists in

Re: Curious to see alternate approach on a search/replace via regex

2013-02-07 Thread Dave Angel
any regex code. starttime = time.time() for i in range(numloops): u2f() msg = '\nElapsed {0:.3f}'.format(time.time() - starttime) print(msg) -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: Curious to see alternate approach on a search/replace via regex

2013-02-06 Thread Roy Smith
In article mailman.1425.1360186878.2939.python-l...@python.org, rh richard_hubb...@lavabit.com wrote: I am curious to know if others would have done this differently. And if so how so? This converts a url to a more easily managed filename, stripping the http protocol off. I would have

Re: Curious to see alternate approach on a search/replace via regex

2013-02-06 Thread Demian Brecht
with the result of: alongnameofasite1234567_com_q_sports_run_a_1_b_1 1288 function calls in 0.004 seconds Compared to regex method: 498 function calls (480 primitive calls) in 0.000 seconds I'd prefer the regex method myself. Demian Brecht http://demianbrecht.github.com On 2013-02-06 1

Re: Curious to see alternate approach on a search/replace via regex

2013-02-06 Thread Demian Brecht
python -m cProfile [script_name].py http://docs.python.org/2/library/profile.html#module-cProfile Demian Brecht http://demianbrecht.github.com On 2013-02-06 2:30 PM, richard_hubbe11 richard_hubb...@lavabit.com wrote: I see that urlparse uses split and not re at all and, in my tests,

Re: Curious to see alternate approach on a search/replace via regex

2013-02-06 Thread MRAB
On 2013-02-06 21:41, rh wrote: I am curious to know if others would have done this differently. And if so how so? This converts a url to a more easily managed filename, stripping the http protocol off. This: http://alongnameofasite1234567.com/q?sports=runa=1b=1 becomes this:

[issue13592] repr(regex) doesn't include actual regex

2013-01-31 Thread Chris Jerdonek
Chris Jerdonek added the comment: See also issue 17087 which is essentially the same issue but for match objects. -- nosy: +chris.jerdonek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13592

[issue16990] re: match of nongreedy regex not grouping right

2013-01-17 Thread Jared Grubb
title: re: match of nongreedy regex not grouping right versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16990 ___ ___ Python-bugs-list mailing

[issue16990] re: match of nongreedy regex not grouping right

2013-01-17 Thread R. David Murray
R. David Murray added the comment: Wouldn't a non-greedy .* match the null string? -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16990 ___

[issue16990] re: match of nongreedy regex not grouping right

2013-01-17 Thread Jared Grubb
Jared Grubb added the comment: Yes: re.match('.*', '') _sre.SRE_Match object at 0x107c6d308 re.match('.*?', '') _sre.SRE_Match object at 0x107c6d370 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16990

[issue16990] re: match of nongreedy regex not grouping right

2013-01-17 Thread R. David Murray
R. David Murray added the comment: So, group() is returning the correct value, then. -- resolution: - invalid stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16990

[issue16990] re: match of nongreedy regex not grouping right

2013-01-17 Thread Jared Grubb
Jared Grubb added the comment: You're right. My mistake. I thought match meant the full string must match, but in Python it means the beginning must match. Sorry for the noise. -- ___ Python tracker rep...@bugs.python.org

Regex not matching a string

2013-01-09 Thread python . prog29
Hi All - In the following code ,am trying to remove a multi line - comment that contains This is a test comment for some reason the regex is not matching.. can anyone provide inputs on why it is so? import os import sys import re import fnmatch def find_and_remove(haystack, needle

Re: Regex not matching a string

2013-01-09 Thread Steven D'Aprano
On Wed, 09 Jan 2013 02:08:23 -0800, python.prog29 wrote: Hi All - In the following code ,am trying to remove a multi line - comment that contains This is a test comment for some reason the regex is not matching.. can anyone provide inputs on why it is so? It works for me. Some

Re: Regex not matching a string

2013-01-09 Thread Peter Otten
python.pro...@gmail.com wrote: In the following code ,am trying to remove a multi line - comment that contains This is a test comment for some reason the regex is not matching.. can anyone provide inputs on why it is so? def find_and_remove(haystack, needle): pattern = re.compile(r

Re: ignore case only for a part of the regex?

2013-01-02 Thread wxjmfauth
://mail.python.org/mailman/listinfo/python-list Hi, just for completeness, the mentioned regex library can take care of casfolding in case insensitive matching (in all supported versions: Python 2.5-2.7 and 3.1-3.3); i.e.: # case sensitive match: for m in regex.findall(urStraße, u STRAßE

Re: ignore case only for a part of the regex?

2013-01-01 Thread Vlastimil Brom
('LATIN CAPITAL LETTER SHARP S') 'ẞ' -- Steven -- http://mail.python.org/mailman/listinfo/python-list Hi, just for completeness, the mentioned regex library can take care of casfolding in case insensitive matching (in all supported versions: Python 2.5-2.7 and 3.1-3.3); i.e.: # case

Re: ignore case only for a part of the regex?

2012-12-31 Thread Steven D'Aprano
On Sun, 30 Dec 2012 10:20:19 -0500, Roy Smith wrote: The way I would typically do something like this is build my regexes in all lower case and .lower() the text I was matching against them. I'm curious what you're doing where you want to enforce case sensitivity in one part of a header, but

re: ignore case only for a part of the regex?

2012-12-30 Thread Helmut Jarausch
Hi, is there a means to specify that 'ignore-case' should only apply to a part of a regex? E.g. the regex should match Msg-id:, Msg-Id, ... but not msg-id: and so on. I've tried the pattern r'^Msg-(?:(?i)id):' but (?i) makes the whole pattern ignoring case. In my simple case I could say

Re: ignore case only for a part of the regex?

2012-12-30 Thread Roy Smith
Helmut Jarausch jarau...@skynet.be wrote: is there a means to specify that 'ignore-case' should only apply to a part of a regex? Not that I'm aware of. the regex should match Msg-id:, Msg-Id, ... but not msg-id: and so on. What's the use-case for this? The way I would typically do

Re: ignore case only for a part of the regex?

2012-12-30 Thread Joel Goldstick
On Sun, Dec 30, 2012 at 10:20 AM, Roy Smith r...@panix.com wrote: Helmut Jarausch jarau...@skynet.be wrote: is there a means to specify that 'ignore-case' should only apply to a part of a regex? Python has excellent string methods. There seems to be a split between people who first

Re: ignore case only for a part of the regex?

2012-12-30 Thread Vlastimil Brom
2012/12/30 Helmut Jarausch jarau...@skynet.be: Hi, is there a means to specify that 'ignore-case' should only apply to a part of a regex? E.g. the regex should match Msg-id:, Msg-Id, ... but not msg-id: and so on. I've tried the pattern r'^Msg-(?:(?i)id):' but (?i) makes the whole

Re: ignore case only for a part of the regex?

2012-12-30 Thread Roy Smith
In article mailman.1467.1356885520.29569.python-l...@python.org, Vlastimil Brom vlastimil.b...@gmail.com wrote: you may check the new regex implementation for python http://pypi.python.org/pypi/regex Wow, I wasn't aware of such an effort. At first reading, I'm amused by the concept of strict

Re: ignore case only for a part of the regex?

2012-12-30 Thread MRAB
On 2012-12-30 17:32, Roy Smith wrote: In article mailman.1467.1356885520.29569.python-l...@python.org, Vlastimil Brom vlastimil.b...@gmail.com wrote: you may check the new regex implementation for python http://pypi.python.org/pypi/regex Wow, I wasn't aware of such an effort. At first

Re: ignore case only for a part of the regex?

2012-12-30 Thread Cameron Simpson
On 30Dec2012 12:32, Roy Smith r...@panix.com wrote: | In article mailman.1467.1356885520.29569.python-l...@python.org, | Vlastimil Brom vlastimil.b...@gmail.com wrote: | you may check the new regex implementation for python | http://pypi.python.org/pypi/regex [...] | I'm not sure I like

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-30 Thread Georg Brandl
Georg Brandl added the comment: I think you will, Matthew being MRAB on the mailing lists :) -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688 ___

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-29 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688 ___ ___

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset 44a4f9289faa by Serhiy Storchaka in branch '3.3': Issue #16688: Fix backreferences did make case-insensitive regex fail on non-ASCII strings. http://hg.python.org/cpython/rev/44a4f9289faa New changeset c59ee1ff6f27 by Serhiy Storchaka in branch

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Fixed. Thank you for a patch, Matthew. I hope to see more your patches. -- resolution: - fixed stage: commit review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue16760] Get rid of MatchObject in regex HOWTO

2012-12-25 Thread Roundup Robot
Roundup Robot added the comment: New changeset b11f98872c0f by Ezio Melotti in branch '2.7': #16760: use ref:`match-objects` instead of :class:`MatchObject`. http://hg.python.org/cpython/rev/b11f98872c0f New changeset 7c4ef8faeb4a by Ezio Melotti in branch '3.2': #16760: use ref:`match-objects`

[issue16760] Get rid of MatchObject in regex HOWTO

2012-12-25 Thread Ezio Melotti
Ezio Melotti added the comment: Fixed, thanks for the report! -- assignee: docs@python - ezio.melotti resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16760

[issue16760] Get rid of MatchObject in regex HOWTO

2012-12-25 Thread Andrew Svetlov
Andrew Svetlov added the comment: We need to rename MatchObject to match object than (see #16443) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16760 ___

[issue16760] Get rid of MatchObject in regex HOWTO

2012-12-25 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3bee420d400f by Andrew Svetlov in branch '3.2': rename MathcObject to match object in doctrings for re module (#16760) http://hg.python.org/cpython/rev/3bee420d400f New changeset 73b24ee09e0a by Andrew Svetlov in branch '3.3': rename MathcObject to

[issue16760] Get rid of MatchObject in regex HOWTO

2012-12-25 Thread Roundup Robot
Roundup Robot added the comment: New changeset 6ca8f965fd65 by Andrew Svetlov in branch '2.7': rename MathcObject to match object in doctrings for re module (#16760) http://hg.python.org/cpython/rev/6ca8f965fd65 -- ___ Python tracker

[issue16760] Get rid of MatchObject in regex HOWTO

2012-12-25 Thread Andrew Svetlov
Andrew Svetlov added the comment: Done -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16760 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue16760] Get rid of MatchObject in regex HOWTO

2012-12-25 Thread Ezio Melotti
Ezio Melotti added the comment: Thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16760 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue16760] Get rid of MatchObject in regex HOWTO

2012-12-24 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +akuchling ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16760 ___ ___ Python-bugs-list

[issue16760] Get rid of MatchObject in regex HOWTO

2012-12-24 Thread Serhiy Storchaka
, serhiy.storchaka priority: normal severity: normal status: open title: Get rid of MatchObject in regex HOWTO type: enhancement versions: Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16760

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The patches LGTM. How about adding a test? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688 ___ ___

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-16 Thread Matthew Barnett
Matthew Barnett added the comment: Here are some tests for the issue. -- Added file: http://bugs.python.org/file28330/issue16688#3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The second test pass on unpatched Python. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688 ___ ___

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-16 Thread Matthew Barnett
Matthew Barnett added the comment: Oops! :-( Now corrected. -- Added file: http://bugs.python.org/file28332/issue16688#3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688 ___

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-16 Thread Matthew Barnett
Changes by Matthew Barnett pyt...@mrabarnett.plus.com: Removed file: http://bugs.python.org/file28330/issue16688#3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688 ___

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: LGTM. Matthew, can you please submit a contributor form? http://python.org/psf/contrib/contrib-form/ http://python.org/psf/contrib/ -- stage: patch review - commit review ___ Python tracker rep...@bugs.python.org

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Good analysis, Matthew. Are you want to submit a patch? -- keywords: +easy stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688 ___

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-15 Thread Matthew Barnett
Matthew Barnett added the comment: OK, here's a patch. -- keywords: +patch Added file: http://bugs.python.org/file28321/issue16688.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-15 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688 ___ ___

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-15 Thread STINNER Victor
STINNER Victor added the comment: Can someone check if there is no other similar regression (introduced by the PEP 393)? 2012/12/15 Serhiy Storchaka rep...@bugs.python.org: Changes by Serhiy Storchaka storch...@gmail.com: -- stage: needs patch - patch review

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-15 Thread Matthew Barnett
Matthew Barnett added the comment: I found another bug while looking through the source. On line 495 in function SRE_COUNT: if (maxcount end - ptr maxcount != 65535) end = ptr + maxcount*state-charsize; where 'end' and 'ptr' are of type 'char*'. That means that 'end - ptr' is

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-15 Thread Matthew Barnett
Matthew Barnett added the comment: I found another bug while looking through the source. On line 495 in function SRE_COUNT: if (maxcount end - ptr maxcount != 65535) end = ptr + maxcount*state-charsize; where 'end' and 'ptr' are of type 'char*'. That means that 'end - ptr' is

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-15 Thread Matthew Barnett
Matthew Barnett added the comment: I haven't found any other issues, so here's the second patch. -- Added file: http://bugs.python.org/file28325/issue16688#2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-14 Thread pyos
3.2: r.findall('aa Ā') ['a'] -- components: Regular Expressions messages: 177518 nosy: ezio.melotti, mrabarnett, pitrou, pyos priority: normal severity: normal status: open title: Backreferences make case-insensitive regex fail on non-ASCII strings. type: behavior versions

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-14 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688 ___ ___ Python-bugs-list

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-14 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688 ___ ___

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-14 Thread Ezio Melotti
Ezio Melotti added the comment: It works on 2.7 too, and fails on 3.3/3.x. Maybe it's related to PEP 393? -- versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688 ___

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-14 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16688 ___

[issue16688] Backreferences make case-insensitive regex fail on non-ASCII strings.

2012-12-14 Thread Matthew Barnett
Matthew Barnett added the comment: In function SRE_MATCH, the code for SRE_OP_GROUPREF (line 1290) contains this: while (p e) { if (ctx-ptr = end || SRE_CHARGET(state, ctx-ptr, 0) != SRE_CHARGET(state, p, 0)) RETURN_FAILURE; p += state-charsize;

Re: regex walktrough

2012-12-08 Thread MRAB
On 2012-12-08 17:48, rh wrote: Look through some code I found this and wondered about what it does: ^(?Psalsipuedes[0-9A-Za-z-_.//]+)$ Here's my walk through: 1) ^ match at start of string 2) ?Psalsipuedes if a match is found it will be accessible in a variable salsipuedes 3)

<    5   6   7   8   9   10   11   12   13   14   >