Definitive guide for Regex

Barry Scott barry at barrys-emacs.org
Sat Oct 2 13:27:34 EDT 2021



> On 1 Oct 2021, at 10:58, Shaozhong SHI <shishaozhong at 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 at barrys-emacs.org <mailto:barry at barrys-emacs.org>> wrote:
> 
> 
> > On 30 Sep 2021, at 19:35, dn via Python-list <python-list at python.org <mailto:python-list at python.org>> wrote:
> > 
> > On 01/10/2021 06.16, Barry Scott wrote:
> >> 
> >> 
> >>> On 30 Sep 2021, at 12:29, Shaozhong SHI <shishaozhong at gmail.com <mailto:shishaozhong at 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>



More information about the Python-list mailing list