Go to the source code of this file.
Data Structures | |
| struct | chunk_t |
| the struct that is used to identify a piece of string More... | |
Functions | |
| list_t * | mlmatch (char *data, char *exp, char *ret) |
| Finds Markup Language chuks matching exp. | |
| void | mlmatch_print_results (list_t *res, char *str) |
| debug functions that prints the resul matrix | |
| void | mlmatch_free_results (list_t *res) |
| free the list of lists returned by mlmatch | |
| char * | mlmatch_get_result (int x, int y, list_t *res, char *s) |
| gets a cell from the result matrix | |
Definition in file mlex.h.
| list_t* mlmatch | ( | char * | data, | |
| char * | exp, | |||
| char * | ret | |||
| ) |
Finds Markup Language chuks matching exp.
What is an ml-expression?
Simply a regular expression with some more infos about murkups.
Grammar:
".*<b>([0-9]*(Kb|Mb))</b>"".*<(b|i)>([0-9]*(Kb|Mb))</(b|i)>""a<b>[c]{d}e{f}[g]<h>"{} and [] "<b>". [ since it is reserver for optional strings. You must put the expression into round brackets to avoid this. "<a><b>" is interpreted as this sequence of tokens: "","<a>","","<b>". ".*<b>.*<.*img.*src.*>.*</b>" "O<O>O<X>X<O>""<tt><b><img src="nice.jpg">hello</b>""X") the first defining "img src="nice.jpg"" and the second defining "hello". "<tt><b><img src="nice.jpg">hello</b>" becames "","<tt>","","<b>","","<img src="nice.jpg">","hello","</b>" ".*<b>.*<.*img.*src.*>.*</b>" becames ".*","<b>",".*","<.*img.*src.*>",".*","</b>" "O<O>O<X>X<O>" becames "O","<O>","O","<X>","X","<O>" "","<b>","","<img src="nice.jpg">","hello","</b>" X we obtain {"img src="nice.jpg"","hello".}
| data | is a Markup Language file like an html page (must be modifyable) | |
| exp | is the ml-expression (must be modifyable) | |
| ret | is the ml-get-expression (must be modifyable) |
| void mlmatch_free_results | ( | list_t * | res | ) |
free the list of lists returned by mlmatch
| char* mlmatch_get_result | ( | int | x, | |
| int | y, | |||
| list_t * | res, | |||
| char * | s | |||
| ) |
gets a cell from the result matrix
mlmatch returns a list of lists. this is a matrix. each line is the list of X fields. Example:
src := "<b>hello</b> bad <i>guys</b>"exp := "<.*>.*</b>"ret := "<X>X<O>"rc = mlmatch(src,exp,ret);{{"b","hello"}, {"i","guys"} }0,0 to 1,1. For example "hello" is 1,0. The returned poiter must be freed by the caller.
| x | column | |
| y | row | |
| res | returned by mlmatch | |
| s | the src string |
| void mlmatch_print_results | ( | list_t * | res, | |
| char * | str | |||
| ) |
debug functions that prints the resul matrix
1.5.6