On 2023-11-16 11:34:16 +1300, Rimu Atkinson via Python-list wrote:
> > > Why don't you use re.findall?
> > >
> > > re.findall(r'\b[0-9]{2,7}-[0-9]{2}-[0-9]{2}\b', txt)
> >
> > I think I can see what you did there but it won't make sense to me - or
> > whoever looks at the code - in future.
> >
>
On 11/17/2023 6:17 AM, Peter J. Holzer via Python-list wrote:
On 2023-11-16 11:34:16 +1300, Rimu Atkinson via Python-list wrote:
Why don't you use re.findall?
re.findall(r'\b[0-9]{2,7}-[0-9]{2}-[0-9]{2}\b', txt)
I think I can see what you did there but it won't make sense to me - or
whoever l
On 2023-11-17 07:48:41 -0500, Thomas Passin via Python-list wrote:
> On 11/17/2023 6:17 AM, Peter J. Holzer via Python-list wrote:
> > Oh, and Python (just like Perl) allows you to embed whitespace and
> > comments into Regexps, which helps readability a lot if you have to
> > write long regexps.
>
On 11/17/2023 9:46 AM, Peter J. Holzer via Python-list wrote:
On 2023-11-17 07:48:41 -0500, Thomas Passin via Python-list wrote:
On 11/17/2023 6:17 AM, Peter J. Holzer via Python-list wrote:
Oh, and Python (just like Perl) allows you to embed whitespace and
comments into Regexps, which helps re
Mike Dewhirst ha scritto:
On 15/11/2023 10:25 am, MRAB via Python-list wrote:
On 2023-11-14 23:14, Mike Dewhirst via Python-list wrote:
I'd like to improve the code below, which works. It feels clunky to me.
I need to clean up user-uploaded files the size of which I don't know in
advance.
Aft
On 2023-11-17 09:38, jak via Python-list wrote:
Mike Dewhirst ha scritto:
On 15/11/2023 10:25 am, MRAB via Python-list wrote:
On 2023-11-14 23:14, Mike Dewhirst via Python-list wrote:
I'd like to improve the code below, which works. It feels clunky to me.
I need to clean up user-uploaded file
MRAB ha scritto:
Bare excepts are a very bad idea.
I know, you're right but to test the CAS numbers were inside a string
(txt) and instead of the 'open(file)' there was 'io.StingIO(txt)' so the
risk was almost null. When I copied it here I didn't think about it.
Sorry.
--
https://mail.python.
Many features like regular expressions can be mini languages that are designed
to be very powerful while also a tad cryptic to anyone not familiar.
But consider an alternative in some languages that may use some complex set of
nested function calls that each have names like match_white_space(2,