"Fossies" - the Fresh Open Source Software Archive 
Member "n2n-3.1.1/include/n2n_regex.h" (31 Mar 2022, 2324 Bytes) of package /linux/misc/n2n-3.1.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "n2n_regex.h" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
3.0_vs_3.1.1.
1 /**
2 * (C) 2007-22 - ntop.org and contributors
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not see see <http://www.gnu.org/licenses/>
16 *
17 */
18
19 // taken from https://github.com/kokke/tiny-regex-c
20 // under Unlicense as of August 4, 2020
21
22 /*
23 *
24 * Mini regex-module inspired by Rob Pike's regex code described in:
25 *
26 * http://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html
27 *
28 *
29 *
30 * Supports:
31 * ---------
32 * '.' Dot, matches any character
33 * '^' Start anchor, matches beginning of string
34 * '$' End anchor, matches end of string
35 * '*' Asterisk, match zero or more (greedy)
36 * '+' Plus, match one or more (greedy)
37 * '?' Question, match zero or one (non-greedy)
38 * '[abc]' Character class, match if one of {'a', 'b', 'c'}
39 * '[^abc]' Inverted class, match if NOT one of {'a', 'b', 'c'} -- NOTE: feature is currently broken!
40 * '[a-zA-Z]' Character ranges, the character set of the ranges { a-z | A-Z }
41 * '\s' Whitespace, \t \f \r \n \v and spaces
42 * '\S' Non-whitespace
43 * '\w' Alphanumeric, [a-zA-Z0-9_]
44 * '\W' Non-alphanumeric
45 * '\d' Digits, [0-9]
46 * '\D' Non-digits
47 *
48 *
49 */
50
51 #ifndef _N2N_REGEX_
52 #define _N2N_REGEX_
53
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57
58 #include <stdio.h>
59
60 /* Compile regex string pattern to a regex_t-array. */
61 re_t re_compile (const char* pattern);
62
63
64 /* Find matches of the compiled pattern inside text. */
65 int re_matchp (re_t pattern, const char* text, int* matchlenght);
66
67
68 /* Find matches of the txt pattern inside text (will compile automatically first). */
69 int re_match (const char* pattern, const char* text, int* matchlenght);
70
71
72 #ifdef __cplusplus
73 }
74 #endif
75
76 #endif