Re: Suggestion: Regex string specifier like r and f

2023-01-08 Thread Barry
> On 8 Jan 2023, at 21:16, Raphael Santiago > wrote: > > Maybe something like re"" > It should behave exactly like a raw string but would be useful for syntax > highlighting and debugging. Perhaps also for type hinting expected regex > input

Re: Suggestion: Regex string specifier like r and f

2023-01-08 Thread Cameron Simpson
On 08Jan2023 12:44, Raphael Santiago wrote: Maybe something like re"" It should behave exactly like a raw string but would be useful for syntax highlighting and debugging. Perhaps also for type hinting expected regex input (don't know if this is feasible). A nice idea. (Though I'm

Suggestion: Regex string specifier like r and f

2023-01-08 Thread Raphael Santiago
Maybe something like re"" It should behave exactly like a raw string but would be useful for syntax highlighting and debugging. Perhaps also for type hinting expected regex input (don't know if this is feasible). -- https://mail.python.org/mailman/listinfo/python-list

[issue523041] Robotparser incorrectly applies regex

2022-04-10 Thread admin
Change by admin : -- github: None -> 36164 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue520904] Regex object finditer not documented

2022-04-10 Thread admin
Change by admin : -- github: None -> 36133 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue476912] regex annoyance

2022-04-10 Thread admin
Change by admin : -- github: None -> 35441 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue446136] regex documentation

2022-04-10 Thread admin
Change by admin : -- github: None -> 34868 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue417853] pydoc uses deprecated regex module

2022-04-10 Thread admin
Change by admin : -- github: None -> 34388 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue409504] Fix freeze: regex, continuation lines

2022-04-10 Thread admin
Change by admin : -- github: None -> 34184 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue221654] sre regex () groups have strong memory

2022-04-10 Thread admin
Change by admin : -- github: None -> 33447 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue400955] ptags, eptags: regex->re, 4 char indent.

2022-04-10 Thread admin
Change by admin : ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue221654] sre regex () groups have strong memory

2022-04-10 Thread admin
Change by admin : -- github: None -> 33447 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue400955] ptags, eptags: regex->re, 4 char indent.

2022-04-10 Thread admin
Change by admin : -- github: None -> 32640 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue47248] Possible slowdown of regex searching in 3.11

2022-04-08 Thread Ma Lin
Ma Lin added the comment: > Possibly related to the new atomic grouping support from GH-31982? It seems not likely. I will do some benchmarks for this issue, more information (version/platform) is welcome. -- ___ Python tracker

[issue47248] Possible slowdown of regex searching in 3.11

2022-04-08 Thread Dennis Sweeney
Dennis Sweeney added the comment: Possibly related to the new atomic grouping support from GH-31982? -- nosy: +Dennis Sweeney, serhiy.storchaka ___ Python tracker ___

[issue47248] Possible slowdown of regex searching in 3.11

2022-04-07 Thread Ma Lin
Ma Lin added the comment: Could you give the two versions? I will do a git bisect. I tested 356997c~1 and 356997c [1], msvc2022 non-pgo release build: # regex_dna ### an +- std dev: 151 ms +- 1 ms -> 152 ms +- 1 ms: 1.01x slower t significant # regex_effbot ### an +- std dev: 2.47 ms +-

[issue47248] Possible slowdown of regex searching in 3.11

2022-04-07 Thread Mark Shannon
a regression in the sre module itself, but I can't say so for certain. -- keywords: 3.11regression messages: 416923 nosy: Mark.Shannon priority: normal severity: normal status: open title: Possible slowdown of regex searching in 3.11 type: performance versions: Python 3.11

[issue47163] "unterminated subpattern" in valid regex if re.VERBOSE is used

2022-03-30 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue47163] "unterminated subpattern" in valid regex if re.VERBOSE is used

2022-03-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: "#" in VERBOSE mode starts a comment and skips to the end of the line. Escape it: "\#". -- nosy: +serhiy.storchaka resolution: not a bug -> stage: resolved -> status: closed -> open ___ Python tracker

[issue47163] "unterminated subpattern" in valid regex if re.VERBOSE is used

2022-03-30 Thread Ned Batchelder
Ned Batchelder added the comment: I realized my mistake... never mind! -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___

[issue47163] "unterminated subpattern" in valid regex if re.VERBOSE is used

2022-03-30 Thread Ned Batchelder
New submission from Ned Batchelder : In this code, the same regex is compiled with and without re.VERBOSE. Without, it compiles fine. With, it fails with an "unterminated subpattern" error. list_num_rx1 = r"""(?P\()?(\d+|#|[a-z])(?(paren)\)|\.)"&qu

[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2022-03-20 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue47023] re.sub shows key error on regex escape chars provided in repl param

2022-03-17 Thread Eric V. Smith
Eric V. Smith added the comment: I agree the error message could be better. Also, "s.error('bad escape %s' % this, len(this))" should probably be "from None", since as @mrabarnett notes the KeyError is an implementation detail. -- ___ Python

[issue47023] re.sub shows key error on regex escape chars provided in repl param

2022-03-17 Thread Matthew Barnett
Matthew Barnett added the comment: I'd just like to point out that to a user it could _look_ like a bug, that an error occurred while reporting, because the traceback isn't giving a 'clean' report; the stuff about the KeyError is an internal detail. --

[issue47023] re.sub shows key error on regex escape chars provided in repl param

2022-03-17 Thread Eric V. Smith
Eric V. Smith added the comment: Yes, I assume that's what the OP intended, but then stumbled across the error with '\s'. In any event, I don't think there's a bug here so I'm going to close this. @siddheshsathe: if you disagree, please respond here. -- resolution: -> not a bug

[issue47023] re.sub shows key error on regex escape chars provided in repl param

2022-03-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: There seem to be a number of escaping problems in the OP's example. Is this what was intended? >>> re.sub(r"\{(\w+)\}", r"\1", "Hello! {user}") 'Hello! user' -- nosy: +rhettinger status: pending -> open ___

[issue47023] re.sub shows key error on regex escape chars provided in repl param

2022-03-17 Thread Eric V. Smith
Change by Eric V. Smith : -- status: open -> pending ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue47023] re.sub shows key error on regex escape chars provided in repl param

2022-03-15 Thread Eric V. Smith
Eric V. Smith added the comment: Isn't '\s' covered by: " Unknown escapes of ASCII letters are reserved for future use and treated as errors" (https://docs.python.org/3/library/re.html#re.sub)? -- nosy: +eric.smith ___ Python tracker

[issue47023] re.sub shows key error on regex escape chars provided in repl param

2022-03-15 Thread Siddhesh Sathe
gular Expressions messages: 415225 nosy: ezio.melotti, mrabarnett, siddheshsathe priority: normal severity: normal status: open title: re.sub shows key error on regex escape chars provided in repl param type: enhancement versions: Python 3.9 ___ Python tracke

[issue46945] Quantifier and Expanded Regex Expression Gives Different Results

2022-03-07 Thread Eric V. Smith
Change by Eric V. Smith : -- components: +Regular Expressions -Library (Lib) nosy: +ezio.melotti, mrabarnett ___ Python tracker ___

[issue46945] Quantifier and Expanded Regex Expression Gives Different Results

2022-03-07 Thread Vedran Čačić
Vedran Čačić added the comment: Confirmed. On Python 3.10.2, >>> re.findall(r"(((\w)+\w*\3){2}|(\w)+(?=\w*\4)\w*(?!\4)(\w)\w*\5)\w*",'alabama') [] yet https://regex101.com/r/uT8gag/1 (with "Python" selected) says it should match. -- nosy: +veky

[issue46945] Quantifier and Expanded Regex Expression Gives Different Results

2022-03-07 Thread Vivian D
New submission from Vivian D : Here are the steps that I went through to test my regular expressions in my command prompt (a file attachment shows this as well). I am using Windows 11, version 21H2: >>> import re >>> regex = r"(((\w)+\w*\3){2}|(\w)+(?=\w*\

[issue46692] match case does not support regex

2022-02-09 Thread Eric V. Smith
Eric V. Smith added the comment: Good catch, @xtreak. I think something like the discussed (but not implemented) custom matching protocol would be required here. __match_args__ won't work, because it's a special attribute only checked on classes, not instances. Of course, I'm still not sure

[issue46692] match case does not support regex

2022-02-09 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: > There were ideas for exotic matchers such as IsInstance(), InRange(), > RegexMatchingGroup() and so on. https://www.python.org/dev/peps/pep-0622/#custom-matching-protocol The PEP has some mention about a similar use case in custom match protocol

[issue46692] match case does not support regex

2022-02-09 Thread Eric V. Smith
Eric V. Smith added the comment: Looking at PEP 634, the obvious way to add support for this is to have the re.Match object specify Py_TPFLAGS_MAPPING. But I tried that, and then I get this error when using an re.Match object in a match statement: case {'one': x, 'two': y}:

[issue46692] match case does not support regex

2022-02-09 Thread Eric V. Smith
Eric V. Smith added the comment: Oops, slight bug in my code. Use this: import re def f(map): print(f'input={map["one"]} {map["two"]}') match map: case {'one': x, 'two': y}: print(f"match {x} {y}") case _: print("no match") d = {'one':0,

[issue46692] match case does not support regex

2022-02-09 Thread Eric V. Smith
Change by Eric V. Smith : -- components: +Interpreter Core ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46692] match case does not support regex

2022-02-09 Thread Eric V. Smith
New submission from Eric V. Smith : You need to provide more information. Is your concern that re.match objects aren't matched like dicts are, despite looking like a mapping? import re def f(map): print(f'input={m["one"]} {m["two"]}') match map: case {'one': x, 'two': y}:

[issue46692] match case does not support regex

2022-02-09 Thread Ali Rn
Change by Ali Rn : -- components: Regular Expressions nosy: AliRn, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: match case does not support regex type: behavior versions: Python 3.10, Python 3.11 ___ Python tracker

[issue46627] Regex hangs indefinitely

2022-02-03 Thread Tim Peters
Tim Peters added the comment: Introducing some kind of optional timeout is too involved to just drop in without significant discussion and design effort first. If you want to pursue this, please bring it up on the python-ideas mailing list. My first take: it wouldn't really help, because

[issue46627] Regex hangs indefinitely

2022-02-03 Thread J.B. Langston
J.B. Langston added the comment: Sorry, on rereading your message I guess you were referring to the extra +, not the [^]]. The extra + after the ) was not intentional, and after removing it, the regex no longer hangs. I still think it would be nice to have a timeout setting on the regex so

[issue46627] Regex hangs indefinitely

2022-02-03 Thread J.B. Langston
with it. Furthermore, it is not what caused the regex to hang. That was caused by "(?P[^,]+)," and changing it to "(?P.+?)," fixed the problem. -- ___ Python tracker <https://bug

[issue46627] Regex hangs indefinitely

2022-02-03 Thread Matthew Barnett
Matthew Barnett added the comment: That pattern has: (?P[^]]+)+ Is that intentional? It looks wrong to me. -- ___ Python tracker ___

[issue46627] Regex hangs indefinitely

2022-02-03 Thread J.B. Langston
New submission from J.B. Langston : The following code will cause Python's regex engine to hang apparently indefinitely: import re message = "Flushed to [BigTableReader(path='/data/cassandra/data/log/logEntry_202202-e68971800b2711ecaf770d5fa3f5ae87/md-112-big-Data.db')] (1 sst

[issue43862] warnings: -W option and PYTHONWARNINGS now use the message as a regex

2021-12-13 Thread STINNER Victor
STINNER Victor added the comment: I mark this issue as a duplicate of bpo-34624. -- resolution: -> duplicate stage: patch review -> resolved status: open -> closed superseder: -> -W option and PYTHONWARNINGS env variable does not accept module regexes

[issue45826] unittest.assertRaisesRegex is broken in Python 3.11 and leading to crashing if tested regex does not match name.

2021-11-17 Thread Łukasz Langa
Łukasz Langa added the comment: Thanks, Dennis! ✨  ✨ -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.10 ___ Python tracker

[issue45826] unittest.assertRaisesRegex is broken in Python 3.11 and leading to crashing if tested regex does not match name.

2021-11-17 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset 8eabe60108b536b942c791b5d3dc3c3020497aac by Łukasz Langa in branch '3.10': [3.10] bpo-45826: Fix a crash in suggestions.c by checking for `traceback is None` (GH-29590) (GH-29602)

[issue45826] unittest.assertRaisesRegex is broken in Python 3.11 and leading to crashing if tested regex does not match name.

2021-11-17 Thread Łukasz Langa
Change by Łukasz Langa : -- pull_requests: +27845 pull_request: https://github.com/python/cpython/pull/29602 ___ Python tracker ___

[issue45826] unittest.assertRaisesRegex is broken in Python 3.11 and leading to crashing if tested regex does not match name.

2021-11-17 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset 5d90c467c02ffefdb13c1abc83a171db1a99ffad by Dennis Sweeney in branch 'main': bpo-45826: Fix a crash in suggestions.c by checking for `traceback is None` (GH-29590) https://github.com/python/cpython/commit/5d90c467c02ffefdb13c1abc83a171db1a99ffad

[issue45826] unittest.assertRaisesRegex is broken in Python 3.11 and leading to crashing if tested regex does not match name.

2021-11-16 Thread Dennis Sweeney
Change by Dennis Sweeney : -- keywords: +patch pull_requests: +27833 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29590 ___ Python tracker ___

[issue45826] unittest.assertRaisesRegex is broken in Python 3.11 and leading to crashing if tested regex does not match name.

2021-11-16 Thread Dennis Sweeney
Dennis Sweeney added the comment: Even shorter reproducer: - try: aab except BaseException as E: E.with_traceback(None) raise ZeroDivisionError() - Bisection points to the initial implementation of suggestions.c:

[issue45826] unittest.assertRaisesRegex is broken in Python 3.11 and leading to crashing if tested regex does not match name.

2021-11-16 Thread Dennis Sweeney
Dennis Sweeney added the comment: Here's shorter reproducer not involving unittest: import sys try: aab except: exc_type, exc_value, tb = sys.exc_info() exc_value.with_traceback(None) raise ZeroDivisionError() -- ___ Python

[issue45826] unittest.assertRaisesRegex is broken in Python 3.11 and leading to crashing if tested regex does not match name.

2021-11-16 Thread Dennis Sweeney
Dennis Sweeney added the comment: I got a segfault in a similar location: static PyObject * offer_suggestions_for_name_error(PyNameErrorObject *exc) { PyObject *name = exc->name; // borrowed reference PyTracebackObject *traceback = (PyTracebackObject *) exc->traceback; // borrowed

[issue45826] unittest.assertRaisesRegex is broken in Python 3.11 and leading to crashing if tested regex does not match name.

2021-11-16 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Running it in debug build mode ./python -X dev ../bpo45826.py python: Python/suggestions.c:215: offer_suggestions_for_name_error: Assertion `frame != NULL' failed. Fatal Python error: Aborted Current thread

[issue45826] unittest.assertRaisesRegex is broken in Python 3.11 and leading to crashing if tested regex does not match name.

2021-11-16 Thread Xinmeng Xia
New submission from Xinmeng Xia : In Python 3.11, unittest.assertRaisesRegex is broken and leading to crashing if tested regex does not match name. See the following example: test.py = import unittest class uTest(unittest.TestCase): pass uTest

[issue3262] re.split doesn't split with zero-width regex

2021-11-04 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg405692 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue3262] re.split doesn't split with zero-width regex

2021-11-04 Thread Eryk Sun
Change by Eryk Sun : -- nosy: -ahmedsayeed1982 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue3262] re.split doesn't split with zero-width regex

2021-11-04 Thread Ahmed Sayeed
Ahmed Sayeed added the comment: Minimal testcase: http://www.compilatori.com/category/computers/ .align 8 .globl main http://www.acpirateradio.co.uk/category/property/ .globl insn .type main, @function http://www.logoarts.co.uk/category/services/ .type

Re: Definitive guide for Regex

2021-10-05 Thread Karsten Hilbert
Am Thu, Sep 30, 2021 at 12:29:16PM +0100 schrieb Shaozhong SHI: > I am trying to look for a definitive guide for Regex in Python. > Can anyone help? If you tell us what you tried in order to look we can perhaps guide you on how to take a better look. Spoonfeeding doesn't seem to be a well

Re: Definitive guide for Regex

2021-10-02 Thread Barry Scott
> On 1 Oct 2021, at 10:58, Shaozhong SHI wrote: > > Hi, Barry, > > In cases of automating checking, validation and producing reports in the > context of data quality control and giving specific feedback to production > teams, regex is perhaps the only way. > >

Re: Definitive guide for Regex

2021-10-01 Thread Jach Feng
Shaozhong SHI 在 2021年9月30日 星期四下午7:29:47 [UTC+8] 的信中寫道: > Dear All, > > I am trying to look for a definitive guide for Regex in Python. > Can anyone help? > > Regards, > > David Try the rexegg.com which is a site dedicate to this subject and has many reso

Re: Definitive guide for Regex

2021-10-01 Thread Shaozhong SHI
Hi, Barry, In cases of automating checking, validation and producing reports in the context of data quality control and giving specific feedback to production teams, regex is perhaps the only way. Perhaps, we can give each element of data specifications a name, that are associated with a regex

Re: Definitive guide for Regex

2021-09-30 Thread Barry Scott
> On 30 Sep 2021, at 19:35, dn via Python-list wrote: > > On 01/10/2021 06.16, Barry Scott wrote: >> >> >>> On 30 Sep 2021, at 12:29, Shaozhong SHI wrote: >>> >>> Dear All, >>> >>> I am trying to look for a definitive gu

Re: Definitive guide for Regex

2021-09-30 Thread dn via Python-list
On 01/10/2021 06.16, Barry Scott wrote: > > >> On 30 Sep 2021, at 12:29, Shaozhong SHI wrote: >> >> Dear All, >> >> I am trying to look for a definitive guide for Regex in Python. >> Can anyone help? > > Have you read the python docs for the r

Re: Definitive guide for Regex

2021-09-30 Thread Barry Scott
> On 30 Sep 2021, at 12:29, Shaozhong SHI wrote: > > Dear All, > > I am trying to look for a definitive guide for Regex in Python. > Can anyone help? Have you read the python docs for the re module? Barry > > Regards, > > David > -- > https://mai

Definitive guide for Regex

2021-09-30 Thread Shaozhong SHI
Dear All, I am trying to look for a definitive guide for Regex in Python. Can anyone help? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

[issue44939] proposal: add support for regex in Literal type hint

2021-08-17 Thread Leon Mintz
New submission from Leon Mintz : Could typing.Literal (or analogous) accept a regex pattern to match against? For example, if I want a duration string, duration: str # allowed syntax: 3s, 3m, 3h etc. vs duration: LiteralPattern['[0-9]+[smh]'] -- messages: 399787 nosy: leon.mintz

[issue44699] Simple regex appears to take exponential time in length of input

2021-07-21 Thread János Brezniczky
János Brezniczky added the comment: Hello! Thanks for the reply - you are probably right, and I accept that it's normal. However, there may be numerous frameworks getting built on the concept of collaboratively contributed regexes. (Python likes prototyping, prototyping likes portable

[issue44699] Simple regex appears to take exponential time in length of input

2021-07-21 Thread Matthew Barnett
Matthew Barnett added the comment: It's called "catastrophic backtracking". Think of the number of ways it could match, say, 4 characters: 4, 3+1, 2+2, 2+1+1, 1+3, 1+2+1, 1+1+2, 1+1+1+1. Now try 5 characters... -- ___ Python tracker

[issue44699] Simple regex appears to take exponential time in length of input

2021-07-21 Thread János Brezniczky
János Brezniczky added the comment: I'd also raise for consideration the introduction a (default?) timeout on regexes, similarly to how such a feature seems available in .NET. Given the DOS vector vs. occasionally non-trivially complex expressions, this could draw developer attention to

[issue44699] Simple regex appears to take exponential time in length of input

2021-07-21 Thread János Brezniczky
János Brezniczky added the comment: Might be related to https://bugs.python.org/issue43075, as in would trigger ReDOSability had my syntax highlighting-related changes (which eventually broke golden master tests, fortunately :) ) hit the public. (Meaning my reduced - possibly minimal -

[issue44699] Simple regex appears to take exponential time in length of input

2021-07-21 Thread János Brezniczky
New submission from János Brezniczky : I don't know if it's normal, but it's impractical. I seem to have come by an expression consuming o(c^n) CPU cycles with c around 2. Regex: \*([^*]+)*\* Resulted in times (in seconds) of 0.17 (* is there anybody out?) 0.34 1 0.69 12 1.36 123 2.73

[issue24929] _strptime.TimeRE should not enforce range in regex

2021-05-21 Thread Catherine Devlin
Catherine Devlin added the comment: Thinking about this a little more... I suggest that slowing down execution shouldn't be a worry in this case, because trying to parse a garbage string into a date shouldn't be something code is doing zillions of times, and if it is, being slow isn't a

[issue24929] _strptime.TimeRE should not enforce range in regex

2021-05-19 Thread Catherine Devlin
Catherine Devlin added the comment: Can we close the ticket? It doesn't sound like we're going to go with anything like this approach. If there's a good place to record the general ambitions (better strptime tests, more clear strptime errors), that would be good, but I don't think we use

[issue24929] _strptime.TimeRE should not enforce range in regex

2021-05-18 Thread Paul Ganssle
this directly in `_strptime` (possibly immediately after the string is parsed by the regex), and raising a cleaner error message on failure. Probably not worth spending a ton of time on that compared to improving the testing around this so that we can feel confident making changes under the hood

[issue24929] _strptime.TimeRE should not enforce range in regex

2021-05-18 Thread Catherine Devlin
Change by Catherine Devlin : -- keywords: +patch nosy: +Catherine.Devlin nosy_count: 2.0 -> 3.0 pull_requests: +24832 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/26215 ___ Python tracker

[issue43862] warnings: -W option and PYTHONWARNINGS now use the message as a regex

2021-04-22 Thread STINNER Victor
STINNER Victor added the comment: I also created a thread on python-dev: https://mail.python.org/archives/list/python-...@python.org/thread/JMKLA4RUJLTORBPPTM4BWL76VNNMKYVG/ -- ___ Python tracker

[issue43862] warnings: -W option and PYTHONWARNINGS now use the message as a regex

2021-04-16 Thread STINNER Victor
STINNER Victor added the comment: New changeset 62ec63864822de1dd1933225584e8503ac40c1f9 by Victor Stinner in branch 'master': bpo-43862: Enhance -W cmdline option documentation (GH-25439) https://github.com/python/cpython/commit/62ec63864822de1dd1933225584e8503ac40c1f9 --

[issue43862] warnings: -W option and PYTHONWARNINGS now use the message as a regex

2021-04-16 Thread STINNER Victor
STINNER Victor added the comment: > Sadly, the current -W option documentation is wrong :-( I started by writing > PR 25439 to fix the documentation, before changing its behavior. Hum, "wrong" may be too strong. I would say that it is at least misleading. It starts with "file:line:

[issue43862] warnings: -W option and PYTHONWARNINGS now use the message as a regex

2021-04-16 Thread STINNER Victor
STINNER Victor added the comment: Sadly, the current -W option documentation is wrong :-( I started by writing PR 25439 to fix the documentation, before changing its behavior. -- ___ Python tracker

[issue43862] warnings: -W option and PYTHONWARNINGS now use the message as a regex

2021-04-16 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +24169 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25439 ___ Python tracker ___

[issue43862] warnings: -W option and PYTHONWARNINGS now use the message as a regex

2021-04-16 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: See also https://bugs.python.org/issue34624 -- nosy: +xtreak ___ Python tracker ___

[issue43862] warnings: -W option and PYTHONWARNINGS now use the message as a regex

2021-04-16 Thread STINNER Victor
-- components: Library (Lib) messages: 391190 nosy: vstinner priority: normal severity: normal status: open title: warnings: -W option and PYTHONWARNINGS now use the message as a regex versions: Python 3.10 ___

[issue43726] regex module fails with a quantified backref but succeeds with repeated backref

2021-04-04 Thread David Ellsworth
David Ellsworth added the comment: Thanks, I didn't realize. I thought it was an official module that wasn't included as part of the main package due to being unfinished. Reported the bug here: https://bitbucket.org/mrabarnett/mrab-regex/issues/408/regex-fails-with-a-quantified

[issue43726] regex module fails with a quantified backref but succeeds with repeated backref

2021-04-04 Thread Patrick Reader
Patrick Reader added the comment: The `regex` module is a third-party package, not part of the Python standard library. Please report issues here: https://bitbucket.org/mrabarnett/mrab-regex/issues -- nosy: +pxeger ___ Python tracker <ht

[issue43726] regex module fails with a quantified backref but succeeds with repeated backref

2021-04-04 Thread David Ellsworth
New submission from David Ellsworth : The regex /^((x*)\2{3}(?=\2$))*x$/ matches powers of 5 in unary, expressed as strings of "x" characters whose length is the number. The following command line should print "1", but prints nothing: python -c 'import regex; regex.matc

[issue2636] Adding a new regex module (compatible with re)

2021-01-25 Thread STINNER Victor
STINNER Victor added the comment: It's now a third party project: https://pypi.org/project/regex/ If someone wants to move it into the Python stdlib, I suggest to start on the python-ideas list first. I close the issue as REJECTED. -- nosy: +vstinner resolution: -> rejected st

[issue42885] Regex performance problem with ^ aka AT_BEGINNING

2021-01-15 Thread Terry J. Reedy
Change by Terry J. Reedy : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42885] Regex performance problem with ^ aka AT_BEGINNING

2021-01-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm getting similar results in Python 3.9. [steve ~]$ python3.9 -m timeit -s "a = 'A'*1" -s "import re" "re.search('^x', a)" 5000 loops, best of 5: 67.3 usec per loop [steve ~]$ python3.9 -m timeit -s "a = 'A'*10" -s "import re" "re.search('^x',

[issue42885] Regex performance problem with ^ aka AT_BEGINNING

2021-01-10 Thread Arnim Rupp
e: ', timeit.timeit(functools.partial(re_test_true, huge_string), number=1)) -- components: Library (Lib) files: regex_timeit.py messages: 384782 nosy: another_try priority: normal severity: normal status: open title: Regex performance problem with ^ aka AT_BEGINNING type: performance versions: Py

[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Renji
Renji added the comment: I through "forward reference" is "\1 (abcd)". Not "some sort of reference in second repetition to data from first repetition". Ok. In other words refers from on repetition to other supported, but with purely formal restrictions. And remove this restrictions don't

[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Matthew Barnett
The reference refers forwards to the group. As I said, the re module doesn't support forward references to groups. If you have a regex where forward references are unavoidable, try the 3rd-party 'regex' module instead. It's available on PyPI

[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Renji
Renji added the comment: In my example reference and capture group presents in two difference alternatives. They don't follow each other, but executed in random order. If this don't supported in one case, why it supported in other case? -- ___

[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Matthew Barnett
Matthew Barnett added the comment: It's not a crash. It's complaining that you're referring to group 2 before defining it. The re module doesn't support forward references to groups, but only backward references to them. -- ___ Python tracker

[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Renji
ot; "+match.group(2)) -- components: Regular Expressions messages: 384703 nosy: Renji, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: Regex compilation crashed if I change order of alternatives under quantifier type: behavior versions: Python 3.7 __

Re: using regex for password validation

2020-12-23 Thread Chris Angelico
On Thu, Dec 24, 2020 at 12:56 PM dn via Python-list wrote: > > On 24/12/2020 12:25, Chris Angelico wrote: > > On Thu, Dec 24, 2020 at 9:42 AM dn via Python-list > > wrote: > >> Hang-on though, look at how much 'work' is involved, compared with a > >> single

Re: using regex for password validation

2020-12-23 Thread dn via Python-list
On 24/12/2020 12:25, Chris Angelico wrote: On Thu, Dec 24, 2020 at 9:42 AM dn via Python-list wrote: Hang-on though, look at how much 'work' is involved, compared with a single line of RegEx! Why go to such bother? There's several reasons. Good question! Look at this alternative: def

Re: using regex for password validation

2020-12-23 Thread dn via Python-list
On 24/12/2020 12:20, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2020-12-24 at 11:41:15 +1300, dn via Python-list wrote: On 24/12/2020 06:03, Sadaka Technology wrote: hello guys, I have this pattern for password validation (regex): [...] Is it my imagination, or does a password

Re: using regex for password validation

2020-12-23 Thread Chris Angelico
On Thu, Dec 24, 2020 at 10:21 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > If you're going to wander out of ASCII, then don't forget to address > Unicode confusables. Nothing is more embarrassing than scribbling your > complicated password on a sticky note and then not being able to tell >

Re: using regex for password validation

2020-12-23 Thread Chris Angelico
On Thu, Dec 24, 2020 at 9:42 AM dn via Python-list wrote: > Hang-on though, look at how much 'work' is involved, compared with a > single line of RegEx! Why go to such bother? There's several reasons. Good question! Look at this alternative: def validate_password(attempt): retu

  1   2   3   4   5   6   7   8   9   10   >