Using regcomp/regexec in code - are POSIX extended regular expressions available all archs?

Matt Grant matt at
Fri Sep 9 23:19:13 UTC 2022

My apologies about this to everyone,  A further explanation:

I am a Linux/Unix  grey beard from the early Nineties, so have memories of
the system library regular expression mess from even up to the early
2000s.  After reading various *BSD and other system man pages on regexp(3)
- old messy regexp ABI/API, and regex(3) the POSIX regex implementation
which is the one used in Samba have realised that we can use this to our

(Perl and Python and libpcre2 are the same code bases on different systems,
so I have always used these in preference)

My current inclination is  still to be cautious about doing very complex
extended POSIX regular expressions in our code base as there are bound to
be corner cases we run into between the different system implementations.
Please correct me on this assessment if I am wrong.

Thank you for being patient with me.

On Fri, 9 Sept 2022 at 19:23, Matt Grant <matt at> wrote:

> Hi!
> Got an answer.
> Have put a simple extended regular expression '^[0-9a-fA-F.:/]+$' in
> source3/utils/testparm.c do_netaccesslist_check() in the merge request.
> Found that source3/param/loadparm.c has REG_ICASE flag in call to
> regcomp(), so it looks like the POSIX regex(3) is supported.
> Thank you!
> Matt Grant
> On Fri, 9 Sept 2022 at 16:21, Matt Grant <matt at> wrote:
>> Hi!
>> I am looking at using these functions in source3/utils/testparm.c to
>> check network/netmask and IP address for use with lib/util/access.c
>> allow_access() parameters for dynamic DNS filters for the SAMBA_INTERNAL
>> dns server.
>> Are the Linux POSIX extended regular expressions available on all compile
>> targets?  (*BSD, Linux, SVr4, AIX, IBM i) etc?
>> Been around Linux since the early nineties.  Things would be easier if
>> Samba supported libpcre2, the Regexps for samba-tool testparm are a slam
>> dunk as they are basically Perl regular expressions.
>> Want to know before cutting code and getting it into master.
>> Best Regards,
>> Matt Grant

More information about the samba-technical mailing list