GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
cobol

Cobol: Fix invalid regex in datetime formatting

Removes trailing pipe from COBOL datetime format to fix regex compatibility.

A trailing pipe character was removed from the time_fmt_b datetime format string in the COBOL compiler. This corrects an invalid regular expression that caused failures with some regex implementations while being tolerated by others, improving cross-platform compatibility.

In Details

The datetime_format_of function in scan_post.h used a regular expression containing a trailing pipe (|). This is an invalid regex syntax. While glibc's regcomp might tolerate it, other implementations (like those on FreeBSD/OpenBSD) reject it. This commit removes the trailing pipe to fix PR cobol/127074.

For Context
regcomp(3)
A C library function used to compile a regular expression pattern into an internal representation for efficient matching.
regular expression
A sequence of characters that defines a search pattern, used for pattern matching with strings.
Filed Under: cobolregexcompatibility