[sr-dev] [kamailio/kamailio] core: allow empty matches (#2869)
Bastian Triller
notifications at github.com
Tue Dec 7 15:09:55 CET 2021
> @btriller - looking again at this one, wouldn't it be the same to do:
>
> ```
> subst_hf("X-My-Header", "/^(.+)$/prefix \1/", "a");
> subst_hf("X-My-Header", "/^(.+)$/\1 suffix/", "a");
> ```
>
> instead of:
>
> ```
> subst_hf("X-My-Header", "/^/prefix /", "a");
> subst_hf("X-My-Header", "/$/ suffix/", "a");
> ```
Knowing that
```
% echo blub|sed 's/^/prefix /'
prefix blub
% echo blub|sed 's/$/ suffix/'
blub suffix
```
works, it felt weird to write
```
subst_hf("X-My-Header", "/^(.)/prefix \1/", "a");
subst_hf("X-My-Header", "/(.)$/\1 suffix/", "a");
```
As most of the time, there are other ways to do it (above suggested or `remove_hf()`, looping over all headers and `append_hf()`).
I understand the concerns, so I don't mind if the PR is closed.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2869#issuecomment-987959909
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20211207/a765ee63/attachment.htm>
More information about the sr-dev
mailing list