ABNF to REGEX Library
MIT License
The ABNF to REGEX library is a pair of PHP functions that validate standard ABNF (RFC 5234) input and generate POSIX and Perl-compatible regular expressions for use in schema and applications.
I provide an online form front-end for these functions at:
http://abnf.msweet.org/
The file "example.php" shows how to implement your own web form.
This function parses the ABNF contained in the supplied string. On success, it returns an array of rules that can be passed to the "abnf_regex" function.
FALSE is returned on failure, with the following global variables describing the issue:
This function generates a regular expression for the named rule. If the named rule does not exist, an empty string is returned.
The "mode" parameter can be any of the following constants:
Copyright (c) 2013-2024 Michael R Sweet
This software is provided under the terms of the MIT license, which is provided in the file "LICENSE.md".