tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: regsub() proposal

    Date:        Fri, 8 Jan 2016 22:07:08 -0500
    From: (Christos Zoulas)
    Message-ID:  <>

Looks like a good idea to me, though I think I'd have a #define to replace
the magic 64's that appear...

And in the man page ...

  | +The
  | +.Fa sub
  | +argument contains a substitution string which might refer to the first
  | +9 regular expression strings using \e<n> to refer to the nth matched
  | +item, or \e& to refer to the full match.

The \e before '&' is wrong, and I can't help but thing that there should
be some markup .Xx \&\en  (for some Xx) to refer to those things.
Probably it should also explicitly mention that \e0 is the same as &
(which is, how I think, regex works, though \0 isn't supposed
to be used, only \1 .. \9)

Lastly, since this is all new, it seems as if having 2 funcs is not
really required, already if one calls your regsub with a NULL buf
arg, it looks to me as if it acts just like aregsub - except the
caller has no way to discover where the result got put.   Wouldn't
one function, what can be used either way, be sufficient?


Home | Main Index | Thread Index | Old Index