controlled environment for regular expressions?

Warren Block wblock at wonkity.com
Mon Sep 1 21:38:24 UTC 2014


On Mon, 1 Sep 2014, David Benfell wrote:

> Hi all,
>
> I am having a major problem with regular expression matching returning
> different results when run from a script under cron or as a delivery
> instruction from postfix rather than from the command line.
>
> I don't even know how to debug this. These are all in scripts and
> delivery instructions that I have had working for over a decade. And
> when I run them from the command line, they work as expected.
>
> The path for seeking executables should not be at issue. I use the
> PATH variable in my crontabs and set it to the same PATH as at a
> terminal.
>
> I have encountered this problem with both grep and GNU sed (gsed, from
> the port).
>
> This is all stuff that worked until recently, and worked for years
> under Linux. The only change I think I've made is to implement an IPv6
> tunnel. I hope, really hope, I can safely say that's irrelevant.
>
> I use zsh, also a choice that's over a decade old, for both my command
> line and to run scripts.
>
> I've never liked regular expressions. I think they are an awful
> kludge. But unfortunately, a major part of my workflow depends on them
> working correctly and *predictably*.
>
> Has anyone else encountered problems with this? How do you fix it?

An example would be useful.  My first guess is that the regexes are 
working, but some invisible whitespace like carriage returns has snuck 
into the values.


More information about the freebsd-questions mailing list