[RESEND PATCH v2] sed: parse delimiters in regular expression correctly
Yao Zi
ziyao at disroot.org
Mon Dec 9 08:06:00 UTC 2024
On Thu, Nov 14, 2024 at 11:10:30AM +0000, Yao Zi wrote:
> As specified in POSIX standard[1], delimiters in bracket expression
> should not terminate the regex and always have their original meaning,
> hus 's/[\/]//' matches either '\' or '/' and 's/[[:alpha:]/]//' matches
> any alphabet or '/'. But with busybox sed,
>
> $ echo a | sed 's/[[:alpha:]/]/b/'
> sed: bad option in substitution expression
> $ echo '\/' | sed 's/[\/]//'
> \
>
> This commit implements a state machine to determine whether a character
> is in a bracket expression, in order to parse escape sequence and
> command delimiters correctly, following the specification and other
> implementation's behavior (GNU and NetBSD). Corresponding test is added
> as well.
Ping on this patch, thanks for your time and review :)
Best regards,
Yao Zi
More information about the busybox
mailing list