Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
[[tags: egg]] [[toc:]] == posix-regex A thin wrapper around [[https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html|POSIX regular expression]] matching. === Introduction This module provides support for regular expressions. Contrary to [[/man/5/Module (chicken irregex)|irregex]], it strictly targets ''Basic Regular Expressions'' (BREs) as well as ''Extended Regular Expressions'' (EREs) as defined in POSIX. For this purpose, it provides a small wrapper around the {{regcomp(3)}} and {{regexec(3)}} functions provided by your libc. Similar to the POSIX interface, a procedure for performing substitutions based on a matched regex is not included out-of-the-box, but [[https://github.com/nmeum/edward/blob/master/lib/replace.scm|can easily be implemented on top]]. === Repository [[https://github.com/nmeum/posix-regex]] === Requirements * [[r7rs]] === API The following subsections provide a brief description of the provided procedures. ==== make-regex <procedure>(make-regex pattern #!optional ignorecase extended multiline)</procedure> Returns a pre-compiled regular expression object for the given {{pattern}}. The optional arguments {{ignorecase}} and {{extended}} specify whether the case should be ignored during matching and if ERE (instead of BRE) syntax should be used. The remaining {{multiline}} optional argument will cause the string to be treated as multiple lines (affects handling of {{^}} and {{$}}). If an error occurs during regex compilation, an exception is raised. ==== regex? <procedure>(regex? obj)</procedure> Returns {{#t}} if {{obj}} is a pre-compiled regular expression, or {{#f}} otherwise. ==== regex-exec <procedure>(regex-exec regex bytevector #!optional notbol noteol)</procedure> Execute the given {{regex}} on the given {{bytevector}}. Returns {{#f}} if the match failed, or a vector of matching subexpressions. In the vector, each element is either {{#f}} (for non-participating optional submatches) or a pair of bytevector offsets. The first element in the pair specifies the beginning of the submatch in the bytevector, the second element specifies the end of the submatch. The first pair in the vector corresponds to the matched substring for the entire regular expression. The optional {{notbol}} and {{noteol}} procedure arguments control whether the first/last character of the input should be considered the start/end of the line. ==== regex-match? <procedure>(regex-match? regex string #!optional notbol noteol)</procedure> Check whether the given {{regex}} is matched by the given {{string}}. If so, {{#t}} is returned, otherwise {{#f}} is returned. This procedure is essentially a variant of {{regex-exec}} which supports strings instead of bytevectors directly and thus doesn't support submatches. Refer to {{regex-exec}} for documentation on the optional {{notbol}} and {{noteol}} procedure parameters. === Version History ; 0.1.0 : Initial release. === License This module is licensed under [[https://spdx.org/licenses/GPL-3.0-only.html|GPL-3.0-only]].
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you subtract 3 from 17?