need help with reinplace

Helmut K. C. Tessarek tessarek at evermeet.cx
Fri Nov 2 23:23:23 UTC 2018


I've been trying for hours now, but I'm not sure where the problem is.
Either there's an issue with escaping or there's a bug somewhere. I know
regex, but this is ridiculous. It's not working and I can't figure out why.

I want to replace the following line in configure.ac
AC_INIT([tmux], next-2.9)
with
AC_INIT([tmux], next-2.9 (${version}))

The

reinplace -E "s|^AC_INIT\(\[tmux\],
(next-\[0-9\]+\.\[0-9\]+)\)$|AC_INIT(\[tmux\], \\1 ${version})|g"
${worksrcpath}/configure.ac

With that I get an error message: invalid command name "0-9"

Weird, but ok. Then I tried to escape the [] character class brackets
and got the following:
Warning: reinplace s|^AC_INIT([tmux],
(next-[0-9]+.[0-9]+))$|AC_INIT([tmux], \1 20181031-b1ad075)|g didn't
change anything in ....

So it seems, it parses the grouping brackets as literal brackets and I'm
really at a loss here.

What is going on?

With sed a working version would look like this:
sed -E "s/AC_INIT\(\[tmux\], (next-[0-9]+\.[0-9]+)\)/AC_INIT([tmux], \\1
(${version}))/g"

Anyhow, can someone please let me know what I am doing wrong and how to
fix this?

Cheers,
  K. C.

-- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the NULL pointer for chaos and madness
   await thee at its end.
*/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20181102/ba62ae63/attachment.sig>


More information about the macports-dev mailing list