00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef header_regexp
00030 #define header_regexp
00031
00032 #include "regexp_match.h"
00033 #include <pcre.h>
00034
00035 class CL_RegExp
00036 {
00038 public:
00039 CL_RegExp(const char *expression, int compile_flags = 0, bool study = false);
00040
00041 CL_RegExp(const CL_StringA &expression, int compile_flags = 0, bool study = false);
00042
00043 ~CL_RegExp();
00044
00046 public:
00047 enum CompileFlags
00048 {
00049 compile_anchored = 1,
00050 compile_auto_callout = 2,
00051 compile_caseless = 4,
00052 compile_dollar_endonly = 8,
00053 compile_dot_all = 16,
00054 compile_extended = 32,
00055 compile_extra = 64,
00056 compile_multi_line = 128,
00057 compile_no_auto_capture = 256,
00058 compile_ungreedy = 512,
00059 compile_utf8 = 1024,
00060 compile_no_utf8_check = 2048
00061 };
00062
00063 enum SearchFlags
00064 {
00065 search_anchored = 1,
00066 search_not_bol = 2,
00067 search_not_eol = 4,
00068 search_not_empty = 8,
00069 search_no_utf8_check = 16,
00070 search_partial = 32
00071 };
00072
00073 int get_string_number(const char *name) const;
00074
00075 int get_string_number(const CL_StringA &name) const;
00076
00078 public:
00079
00080 CL_RegExpMatch search(
00081 const char *subject,
00082 int length,
00083 int start_offset = 0,
00084 int search_flags = 0) const;
00085
00086 CL_RegExpMatch search(
00087 const CL_StringA &subject,
00088 int start_offset = 0,
00089 int search_flags = 0) const;
00090
00091 void search(
00092 const char *subject,
00093 int length,
00094 int start_offset,
00095 int search_flags,
00096 CL_RegExpMatch &result) const;
00097
00098 void search(
00099 const CL_StringA &subject,
00100 int length,
00101 int start_offset,
00102 int search_flags,
00103 CL_RegExpMatch &result) const;
00104
00106 private:
00107 void compile(const char *expression, int compile_flags, bool study);
00108
00109 pcre *code;
00110
00111 pcre_extra *extra;
00112 };
00113
00114 #endif