Mailing List Archive

Definitive guide for Regex
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
Re: Definitive guide for Regex [ In reply to ]
> On 30 Sep 2021, at 12:29, Shaozhong SHI <shishaozhong@gmail.com> 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://mail.python.org/mailman/listinfo/python-list
>

--
https://mail.python.org/mailman/listinfo/python-list
Re: Definitive guide for Regex [ In reply to ]
On 01/10/2021 06.16, Barry Scott wrote:
>
>
>> On 30 Sep 2021, at 12:29, Shaozhong SHI <shishaozhong@gmail.com> 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?


I learned from Jeffrey Friedl's book "Mastering Regular Expressions",
but that was in a land far away, last century, and under a different
language (and the original version - I see it's now up to its third
edition).

Despite their concise exercise of power (and the fact that in my
Python-life I've never been put into a corner where I absolutely must
use one), I'm no longer a fan...
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
Re: Definitive guide for Regex [ In reply to ]
> On 30 Sep 2021, at 19:35, dn via Python-list <python-list@python.org> wrote:
>
> On 01/10/2021 06.16, Barry Scott wrote:
>>
>>
>>> On 30 Sep 2021, at 12:29, Shaozhong SHI <shishaozhong@gmail.com> 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?
>
>
> I learned from Jeffrey Friedl's book "Mastering Regular Expressions",
> but that was in a land far away, last century, and under a different
> language (and the original version - I see it's now up to its third
> edition).
>
> Despite their concise exercise of power (and the fact that in my
> Python-life I've never been put into a corner where I absolutely must
> use one), I'm no longer a fan...

Agreed, regex is the last tool I reach for in python code.
I find I use split() a lot to break up strings for processing.
But there are cases where a regex is the best tool for a particular job
and I then use the re module. But it costs in maintainability.

I speak as the author of a regex engine and know how to write scary
regex's when the need arises.

Barry


> --
> Regards,
> =dn
> --
> https://mail.python.org/mailman/listinfo/python-list
>

--
https://mail.python.org/mailman/listinfo/python-list
Re: Definitive guide for Regex [ In reply to ]
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 resources.

--Jach
--
https://mail.python.org/mailman/listinfo/python-list
Re: Definitive guide for Regex [ In reply to ]
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 value, so that we can automate checking and
reporting on data sets. We can report on which row of records meet
specification and requirements and which one is not. And, report on which
cell needs to be corrected should a row is found not meeting specification
and requirements.

What do you think?

Regards,

David

On Thu, 30 Sept 2021 at 22:02, Barry Scott <barry@barrys-emacs.org> wrote:

>
>
> > On 30 Sep 2021, at 19:35, dn via Python-list <python-list@python.org>
> wrote:
> >
> > On 01/10/2021 06.16, Barry Scott wrote:
> >>
> >>
> >>> On 30 Sep 2021, at 12:29, Shaozhong SHI <shishaozhong@gmail.com>
> 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?
> >
> >
> > I learned from Jeffrey Friedl's book "Mastering Regular Expressions",
> > but that was in a land far away, last century, and under a different
> > language (and the original version - I see it's now up to its third
> > edition).
> >
> > Despite their concise exercise of power (and the fact that in my
> > Python-life I've never been put into a corner where I absolutely must
> > use one), I'm no longer a fan...
>
> Agreed, regex is the last tool I reach for in python code.
> I find I use split() a lot to break up strings for processing.
> But there are cases where a regex is the best tool for a particular job
> and I then use the re module. But it costs in maintainability.
>
> I speak as the author of a regex engine and know how to write scary
> regex's when the need arises.
>
> Barry
>
>
> > --
> > Regards,
> > =dn
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
https://mail.python.org/mailman/listinfo/python-list
Re: Definitive guide for Regex [ In reply to ]
> On 1 Oct 2021, at 10:58, Shaozhong SHI <shishaozhong@gmail.com> 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.
>
> Perhaps, we can give each element of data specifications a name, that are associated with a regex value, so that we can automate checking and reporting on data sets. We can report on which row of records meet specification and requirements and which one is not. And, report on which cell needs to be corrected should a row is found not meeting specification and requirements.
>
> What do you think?

It depends a lot of the details of that you have to validate. There is not enough to guess at a design.
It may well be that uses regex's is a good way to do it.

Barry


>
> Regards,
>
> David
>
> On Thu, 30 Sept 2021 at 22:02, Barry Scott <barry@barrys-emacs.org <mailto:barry@barrys-emacs.org>> wrote:
>
>
> > On 30 Sep 2021, at 19:35, dn via Python-list <python-list@python.org <mailto:python-list@python.org>> wrote:
> >
> > On 01/10/2021 06.16, Barry Scott wrote:
> >>
> >>
> >>> On 30 Sep 2021, at 12:29, Shaozhong SHI <shishaozhong@gmail.com <mailto:shishaozhong@gmail.com>> 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?
> >
> >
> > I learned from Jeffrey Friedl's book "Mastering Regular Expressions",
> > but that was in a land far away, last century, and under a different
> > language (and the original version - I see it's now up to its third
> > edition).
> >
> > Despite their concise exercise of power (and the fact that in my
> > Python-life I've never been put into a corner where I absolutely must
> > use one), I'm no longer a fan...
>
> Agreed, regex is the last tool I reach for in python code.
> I find I use split() a lot to break up strings for processing.
> But there are cases where a regex is the best tool for a particular job
> and I then use the re module. But it costs in maintainability.
>
> I speak as the author of a regex engine and know how to write scary
> regex's when the need arises.
>
> Barry
>
>
> > --
> > Regards,
> > =dn
> > --
> > https://mail.python.org/mailman/listinfo/python-list <https://mail.python.org/mailman/listinfo/python-list>
> >
>
> --
> https://mail.python.org/mailman/listinfo/python-list <https://mail.python.org/mailman/listinfo/python-list>

--
https://mail.python.org/mailman/listinfo/python-list
Re: Definitive guide for Regex [ In reply to ]
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-liked activity,
neither here nor on the PostgreSQL lists.

Best,
Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B
--
https://mail.python.org/mailman/listinfo/python-list