mirror of
https://github.com/cesanta/slre.git
synced 2025-03-13 01:05:29 +00:00
README updated
This commit is contained in:
parent
de6b3578a1
commit
c4c2de058a
14
README.md
14
README.md
@ -18,8 +18,6 @@ so with SLRE.
|
|||||||
^ Match beginning of a buffer
|
^ Match beginning of a buffer
|
||||||
$ Match end of a buffer
|
$ Match end of a buffer
|
||||||
() Grouping and substring capturing
|
() Grouping and substring capturing
|
||||||
[...] Match any character from set
|
|
||||||
[^...] Match any character but ones from set
|
|
||||||
\s Match whitespace
|
\s Match whitespace
|
||||||
\S Match non-whitespace
|
\S Match non-whitespace
|
||||||
\d Match decimal digit
|
\d Match decimal digit
|
||||||
@ -28,9 +26,14 @@ so with SLRE.
|
|||||||
* Match zero or more times (greedy)
|
* Match zero or more times (greedy)
|
||||||
*? Match zero or more times (non-greedy)
|
*? Match zero or more times (non-greedy)
|
||||||
? Match zero or once
|
? Match zero or once
|
||||||
\xDD Match byte with hex value 0xDD
|
|
||||||
\meta Match one of the meta character: ^$().[*+\?
|
|
||||||
x|y Match x or y (alternation operator)
|
x|y Match x or y (alternation operator)
|
||||||
|
\meta Match one of the meta character: ^$().[]*+?|\
|
||||||
|
|
||||||
|
Not supported but in progress:
|
||||||
|
|
||||||
|
[...] Match any character from set
|
||||||
|
[^...] Match any character but ones from set
|
||||||
|
\xDD Match byte with hex value 0xDD
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
@ -62,6 +65,9 @@ which should be an array of following structures:
|
|||||||
|
|
||||||
if (slre_match("^\\s*(\\S+)\\s+(\\S+)\\s+HTTP/(\\d)\\.(\\d)",
|
if (slre_match("^\\s*(\\S+)\\s+(\\S+)\\s+HTTP/(\\d)\\.(\\d)",
|
||||||
request, strlen(request), caps, &error_msg)) {
|
request, strlen(request), caps, &error_msg)) {
|
||||||
|
printf("Method: [%.*s], URI: [%.*s]\n",
|
||||||
|
caps[0].len, caps[0].ptr,
|
||||||
|
caps[1].len, caps[1].ptr);
|
||||||
} else {
|
} else {
|
||||||
printf("Error parsing [%s]: [%s]\n", request, error_msg);
|
printf("Error parsing [%s]: [%s]\n", request, error_msg);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user