pancake e8af14966b * Import the r_regex api in libr/util/regex from OpenBSD source
- Added a r2-like API on top of it
  - Make RSearch and RMagic use this new api, so
* Only load default magicpath files when no file is passed to RMagic
* Initial work on r_listrange optimization in RAnal
  - #define USE_NEW_FCN_STORE
  - Still work-in-progress
* Implemented a RPoolFactory singleton api to accelerate
  allocations of little objects in the future
* Fix sys/mingw32.sh for osx
* Added sys/maemo.sh
2011-09-14 02:07:06 +02:00

32 lines
680 B
C

#include <stdio.h>
#include <r_regex.h>
int _main() {
RRegex rx;
int rc = r_regex_comp (&rx, "^hi", R_REGEX_NOSUB);
if (rc) {
printf ("error\n");
} else {
rc = r_regex_exec (&rx, "patata", 0, 0, 0);
printf ("out = %d\n", rc);
rc = r_regex_exec (&rx, "hillow", 0, 0, 0);
printf ("out = %d\n", rc);
}
r_regex_free (&rx);
return 0;
}
int main() {
RRegex *rx = r_regex_new ("^hi", "");
if (rx) {
int res = r_regex_exec (rx, "patata", 0, 0, 0);
printf ("result (patata) = %d\n", res);
res = r_regex_exec (rx, "hillow", 0, 0, 0);
printf ("result (hillow) = %d\n", res);
r_regex_free (rx);
} else printf ("oops, cannot compile regexp\n");
return 0;
}