 |
JPCRE2
10.32.01
C++ wrapper for PCRE2 library
|
Go to the documentation of this file.
50 #ifndef PCRE2_CODE_UNIT_WIDTH
58 #define PCRE2_CODE_UNIT_WIDTH 0
73 #if __cplusplus >= 201103L || _MSVC_LANG >= 201103L
74 #define JPCRE2_USE_MINIMUM_CXX_11 1
76 #ifndef JPCRE2_USE_FUNCTION_POINTER_CALLBACK
80 #define JPCRE2_USE_MINIMUM_CXX_11 0
83 #define JPCRE2_UNUSED(x) ((void)(x))
84 #if defined(NDEBUG) || defined(JPCRE2_NDEBUG)
85 #define JPCRE2_ASSERT(cond, msg) ((void)0)
86 #define JPCRE2_VECTOR_DATA_ASSERT(cond, name) ((void)0)
88 #define JPCRE2_ASSERT(cond, msg) jpcre2::jassert(cond, msg, __FILE__, __LINE__)
89 #define JPCRE2_VECTOR_DATA_ASSERT(cond, name) jpcre2::_jvassert(cond, name, __FILE__, __LINE__)
113 #define JPCRE2_VERSION 103201L
120 static const char NAME[] =
"JPCRE2";
159 template<
bool B,
typename T =
void>
162 struct EnableIf<true, T>{
typedef T Type;};
164 template<
typename T1,
typename T2>
165 struct IsSame{
static const bool value =
false; };
167 struct IsSame<T,T>{
static const bool value =
true; };
176 static inline void jassert(
bool cond,
const char* msg,
const char* f,
size_t line){
178 std::fprintf(stderr,
"\n\tE: AssertionFailure\n%s\nAssertion failed in file: %s\t at line: %u\n", msg, f, (
unsigned)line);
183 static inline void _jvassert(
bool cond,
char const * name,
const char* f,
size_t line){
184 jassert(cond, (std::string(
"ValueError: \n\
185 Required data vector of type ")+std::string(name)+
" is empty.\n\
186 Your MatchEvaluator callback function is not\n\
187 compatible with existing data!!\n\
188 You are trying to use a vector that does not\n\
189 have any match data. Either call nreplace() or replace()\n\
190 with true or perform a match with appropriate\n\
191 callback function. For more details, refer to\n\
192 the doc in MatchEvaluator section.").c_str(), f, line);
195 static inline std::string _tostdstring(
unsigned x){
197 int written = std::sprintf(buf,
"%u", x);
198 return (written > 0) ? std::string(buf, buf + written) : std::string();
206 template<Ush BS>
struct Pcre2Type;
207 template<Ush BS>
struct Pcre2Func;
211 template<Ush BS>
struct Pcre2Type {};
213 template<>
struct Pcre2Type<8>{
215 typedef PCRE2_UCHAR8 Pcre2Uchar;
216 typedef PCRE2_SPTR8 Pcre2Sptr;
217 typedef pcre2_code_8 Pcre2Code;
218 typedef pcre2_compile_context_8 CompileContext;
219 typedef pcre2_match_data_8 MatchData;
220 typedef pcre2_general_context_8 GeneralContext;
221 typedef pcre2_match_context_8 MatchContext;
222 typedef pcre2_jit_callback_8 JitCallback;
223 typedef pcre2_jit_stack_8 JitStack;
226 template<>
struct Pcre2Type<16>{
228 typedef PCRE2_UCHAR16 Pcre2Uchar;
229 typedef PCRE2_SPTR16 Pcre2Sptr;
230 typedef pcre2_code_16 Pcre2Code;
231 typedef pcre2_compile_context_16 CompileContext;
232 typedef pcre2_match_data_16 MatchData;
233 typedef pcre2_general_context_16 GeneralContext;
234 typedef pcre2_match_context_16 MatchContext;
235 typedef pcre2_jit_callback_16 JitCallback;
236 typedef pcre2_jit_stack_16 JitStack;
239 template<>
struct Pcre2Type<32>{
241 typedef PCRE2_UCHAR32 Pcre2Uchar;
242 typedef PCRE2_SPTR32 Pcre2Sptr;
243 typedef pcre2_code_32 Pcre2Code;
244 typedef pcre2_compile_context_32 CompileContext;
245 typedef pcre2_match_data_32 MatchData;
246 typedef pcre2_general_context_32 GeneralContext;
247 typedef pcre2_match_context_32 MatchContext;
248 typedef pcre2_jit_callback_32 JitCallback;
249 typedef pcre2_jit_stack_32 JitStack;
253 template<Ush BS>
struct Pcre2Func{};
256 template<>
struct Pcre2Func<8> {
257 static Pcre2Type<8>::CompileContext* compile_context_create(Pcre2Type<8>::GeneralContext *gcontext){
258 return pcre2_compile_context_create_8(gcontext);
260 static void compile_context_free(Pcre2Type<8>::CompileContext *ccontext){
261 pcre2_compile_context_free_8(ccontext);
263 static Pcre2Type<8>::CompileContext* compile_context_copy(Pcre2Type<8>::CompileContext* ccontext){
264 return pcre2_compile_context_copy_8(ccontext);
266 static const unsigned char * maketables(Pcre2Type<8>::GeneralContext* gcontext){
267 return pcre2_maketables_8(gcontext);
269 static int set_character_tables(Pcre2Type<8>::CompileContext * ccontext,
const unsigned char * table){
270 return pcre2_set_character_tables_8(ccontext, table);
272 static Pcre2Type<8>::Pcre2Code * compile(Pcre2Type<8>::Pcre2Sptr pattern,
276 PCRE2_SIZE *erroroffset,
277 Pcre2Type<8>::CompileContext *ccontext){
278 return pcre2_compile_8(pattern, length, options, errorcode, erroroffset, ccontext);
280 static int jit_compile(Pcre2Type<8>::Pcre2Code *code, uint32_t options){
281 return pcre2_jit_compile_8(code, options);
283 static int substitute(
const Pcre2Type<8>::Pcre2Code *code,
284 Pcre2Type<8>::Pcre2Sptr subject,
286 PCRE2_SIZE startoffset,
288 Pcre2Type<8>::MatchData *match_data,
289 Pcre2Type<8>::MatchContext *mcontext,
290 Pcre2Type<8>::Pcre2Sptr replacement,
292 Pcre2Type<8>::Pcre2Uchar *outputbuffer,
293 PCRE2_SIZE *outlengthptr){
294 return pcre2_substitute_8( code, subject, length, startoffset, options, match_data,
295 mcontext, replacement, rlength, outputbuffer, outlengthptr);
315 static void code_free(Pcre2Type<8>::Pcre2Code *code){
316 pcre2_code_free_8(code);
318 static int get_error_message(
int errorcode,
319 Pcre2Type<8>::Pcre2Uchar *buffer,
321 return pcre2_get_error_message_8(errorcode, buffer, bufflen);
323 static Pcre2Type<8>::MatchData * match_data_create_from_pattern(
324 const Pcre2Type<8>::Pcre2Code *code,
325 Pcre2Type<8>::GeneralContext *gcontext){
326 return pcre2_match_data_create_from_pattern_8(code, gcontext);
329 static int match(
const Pcre2Type<8>::Pcre2Code *code,
330 Pcre2Type<8>::Pcre2Sptr subject,
332 PCRE2_SIZE startoffset,
334 Pcre2Type<8>::MatchData *match_data,
335 Pcre2Type<8>::MatchContext *mcontext){
336 return pcre2_match_8(code, subject, length, startoffset, options, match_data, mcontext);
338 static void match_data_free(Pcre2Type<8>::MatchData *match_data){
339 pcre2_match_data_free_8(match_data);
341 static PCRE2_SIZE * get_ovector_pointer(Pcre2Type<8>::MatchData *match_data){
342 return pcre2_get_ovector_pointer_8(match_data);
344 static int pattern_info(
const Pcre2Type<8>::Pcre2Code *code, uint32_t what,
void *where){
345 return pcre2_pattern_info_8(code, what, where);
347 static int set_newline(Pcre2Type<8>::CompileContext *ccontext, uint32_t value){
348 return pcre2_set_newline_8(ccontext, value);
374 static uint32_t get_ovector_count(Pcre2Type<8>::MatchData *match_data){
375 return pcre2_get_ovector_count_8(match_data);
380 template<>
struct Pcre2Func<16> {
381 static Pcre2Type<16>::CompileContext* compile_context_create(Pcre2Type<16>::GeneralContext *gcontext){
382 return pcre2_compile_context_create_16(gcontext);
384 static void compile_context_free(Pcre2Type<16>::CompileContext *ccontext){
385 pcre2_compile_context_free_16(ccontext);
387 static Pcre2Type<16>::CompileContext* compile_context_copy(Pcre2Type<16>::CompileContext* ccontext){
388 return pcre2_compile_context_copy_16(ccontext);
390 static const unsigned char * maketables(Pcre2Type<16>::GeneralContext* gcontext){
391 return pcre2_maketables_16(gcontext);
393 static int set_character_tables(Pcre2Type<16>::CompileContext * ccontext,
const unsigned char * table){
394 return pcre2_set_character_tables_16(ccontext, table);
396 static Pcre2Type<16>::Pcre2Code * compile(Pcre2Type<16>::Pcre2Sptr pattern,
400 PCRE2_SIZE *erroroffset,
401 Pcre2Type<16>::CompileContext *ccontext){
402 return pcre2_compile_16(pattern, length, options, errorcode, erroroffset, ccontext);
404 static int jit_compile(Pcre2Type<16>::Pcre2Code *code, uint32_t options){
405 return pcre2_jit_compile_16(code, options);
407 static int substitute(
const Pcre2Type<16>::Pcre2Code *code,
408 Pcre2Type<16>::Pcre2Sptr subject,
410 PCRE2_SIZE startoffset,
412 Pcre2Type<16>::MatchData *match_data,
413 Pcre2Type<16>::MatchContext *mcontext,
414 Pcre2Type<16>::Pcre2Sptr replacement,
416 Pcre2Type<16>::Pcre2Uchar *outputbuffer,
417 PCRE2_SIZE *outlengthptr){
418 return pcre2_substitute_16( code, subject, length, startoffset, options, match_data,
419 mcontext, replacement, rlength, outputbuffer, outlengthptr);
439 static void code_free(Pcre2Type<16>::Pcre2Code *code){
440 pcre2_code_free_16(code);
442 static int get_error_message(
int errorcode,
443 Pcre2Type<16>::Pcre2Uchar *buffer,
445 return pcre2_get_error_message_16(errorcode, buffer, bufflen);
447 static Pcre2Type<16>::MatchData * match_data_create_from_pattern(
448 const Pcre2Type<16>::Pcre2Code *code,
449 Pcre2Type<16>::GeneralContext *gcontext){
450 return pcre2_match_data_create_from_pattern_16(code, gcontext);
453 static int match(
const Pcre2Type<16>::Pcre2Code *code,
454 Pcre2Type<16>::Pcre2Sptr subject,
456 PCRE2_SIZE startoffset,
458 Pcre2Type<16>::MatchData *match_data,
459 Pcre2Type<16>::MatchContext *mcontext){
460 return pcre2_match_16(code, subject, length, startoffset, options, match_data, mcontext);
462 static void match_data_free(Pcre2Type<16>::MatchData *match_data){
463 pcre2_match_data_free_16(match_data);
465 static PCRE2_SIZE * get_ovector_pointer(Pcre2Type<16>::MatchData *match_data){
466 return pcre2_get_ovector_pointer_16(match_data);
468 static int pattern_info(
const Pcre2Type<16>::Pcre2Code *code, uint32_t what,
void *where){
469 return pcre2_pattern_info_16(code, what, where);
471 static int set_newline(Pcre2Type<16>::CompileContext *ccontext, uint32_t value){
472 return pcre2_set_newline_16(ccontext, value);
498 static uint32_t get_ovector_count(Pcre2Type<16>::MatchData *match_data){
499 return pcre2_get_ovector_count_16(match_data);
504 template<>
struct Pcre2Func<32> {
505 static Pcre2Type<32>::CompileContext* compile_context_create(Pcre2Type<32>::GeneralContext *gcontext){
506 return pcre2_compile_context_create_32(gcontext);
508 static void compile_context_free(Pcre2Type<32>::CompileContext *ccontext){
509 pcre2_compile_context_free_32(ccontext);
511 static Pcre2Type<32>::CompileContext* compile_context_copy(Pcre2Type<32>::CompileContext* ccontext){
512 return pcre2_compile_context_copy_32(ccontext);
514 static const unsigned char * maketables(Pcre2Type<32>::GeneralContext* gcontext){
515 return pcre2_maketables_32(gcontext);
517 static int set_character_tables(Pcre2Type<32>::CompileContext * ccontext,
const unsigned char * table){
518 return pcre2_set_character_tables_32(ccontext, table);
520 static Pcre2Type<32>::Pcre2Code * compile(Pcre2Type<32>::Pcre2Sptr pattern,
524 PCRE2_SIZE *erroroffset,
525 Pcre2Type<32>::CompileContext *ccontext){
526 return pcre2_compile_32(pattern, length, options, errorcode, erroroffset, ccontext);
528 static int jit_compile(Pcre2Type<32>::Pcre2Code *code, uint32_t options){
529 return pcre2_jit_compile_32(code, options);
531 static int substitute(
const Pcre2Type<32>::Pcre2Code *code,
532 Pcre2Type<32>::Pcre2Sptr subject,
534 PCRE2_SIZE startoffset,
536 Pcre2Type<32>::MatchData *match_data,
537 Pcre2Type<32>::MatchContext *mcontext,
538 Pcre2Type<32>::Pcre2Sptr replacement,
540 Pcre2Type<32>::Pcre2Uchar *outputbuffer,
541 PCRE2_SIZE *outlengthptr){
542 return pcre2_substitute_32( code, subject, length, startoffset, options, match_data,
543 mcontext, replacement, rlength, outputbuffer, outlengthptr);
563 static void code_free(Pcre2Type<32>::Pcre2Code *code){
564 pcre2_code_free_32(code);
566 static int get_error_message(
int errorcode,
567 Pcre2Type<32>::Pcre2Uchar *buffer,
569 return pcre2_get_error_message_32(errorcode, buffer, bufflen);
571 static Pcre2Type<32>::MatchData * match_data_create_from_pattern(
572 const Pcre2Type<32>::Pcre2Code *code,
573 Pcre2Type<32>::GeneralContext *gcontext){
574 return pcre2_match_data_create_from_pattern_32(code, gcontext);
577 static int match(
const Pcre2Type<32>::Pcre2Code *code,
578 Pcre2Type<32>::Pcre2Sptr subject,
580 PCRE2_SIZE startoffset,
582 Pcre2Type<32>::MatchData *match_data,
583 Pcre2Type<32>::MatchContext *mcontext){
584 return pcre2_match_32(code, subject, length, startoffset, options, match_data, mcontext);
586 static void match_data_free(Pcre2Type<32>::MatchData *match_data){
587 pcre2_match_data_free_32(match_data);
589 static PCRE2_SIZE * get_ovector_pointer(Pcre2Type<32>::MatchData *match_data){
590 return pcre2_get_ovector_pointer_32(match_data);
592 static int pattern_info(
const Pcre2Type<32>::Pcre2Code *code, uint32_t what,
void *where){
593 return pcre2_pattern_info_32(code, what, where);
595 static int set_newline(Pcre2Type<32>::CompileContext *ccontext, uint32_t value){
596 return pcre2_set_newline_32(ccontext, value);
622 static uint32_t get_ovector_count(Pcre2Type<32>::MatchData *match_data){
623 return pcre2_get_ovector_count_32(match_data);
651 std::string
str()
const {
return mod; }
655 char const *
c_str()
const {
return mod.c_str(); }
676 static const char C_N[] =
"eijmnsuxADJU";
680 static const jpcre2::Uint C_V[12] = { PCRE2_MATCH_UNSET_BACKREF,
682 PCRE2_ALT_BSUX | PCRE2_MATCH_UNSET_BACKREF,
684 PCRE2_UTF | PCRE2_UCP,
689 PCRE2_DOLLAR_ENDONLY,
696 static const char CJ_N[] =
"S";
704 static const char R_N[] =
"eEgx";
706 static const jpcre2::Uint R_V[4] = { PCRE2_SUBSTITUTE_UNSET_EMPTY,
707 PCRE2_SUBSTITUTE_UNKNOWN_UNSET | PCRE2_SUBSTITUTE_UNSET_EMPTY,
708 PCRE2_SUBSTITUTE_GLOBAL,
709 PCRE2_SUBSTITUTE_EXTENDED
714 static const char RJ_N[] =
"";
721 static const char M_N[] =
"A";
728 static const char MJ_N[] =
"g";
733 static inline void toOption(Modifier
const& mod,
bool x,
734 Uint const * J_V,
char const * J_N,
SIZE_T SJ,
741 for (
SIZE_T i = 0; i < n; ++i) {
743 for(
SIZE_T j = 0; j < SJ; ++j){
744 if(J_N[j] == mod[i]) {
752 for(
SIZE_T j = 0; j< S; ++j){
768 static inline void toMatchOption(Modifier
const& mod,
bool x,
Uint* po,
Uint* jo,
int* en,
SIZE_T* eo){
770 MJ_V, MJ_N,
sizeof(MJ_V)/
sizeof(
Uint),
771 M_V, M_N,
sizeof(M_V)/
sizeof(
Uint),
775 static inline void toReplaceOption(Modifier
const& mod,
bool x,
Uint* po,
Uint* jo,
int* en,
SIZE_T* eo){
777 RJ_V, RJ_N,
sizeof(RJ_V)/
sizeof(
Uint),
778 R_V, R_N,
sizeof(R_V)/
sizeof(
Uint),
782 static inline void toCompileOption(Modifier
const& mod,
bool x,
Uint* po,
Uint* jo,
int* en,
SIZE_T* eo){
784 CJ_V, CJ_N,
sizeof(CJ_V)/
sizeof(
Uint),
785 C_V, C_N,
sizeof(C_V)/
sizeof(
Uint),
789 static inline std::string fromOption(
Uint const * J_V,
char const * J_N,
SIZE_T SJ,
795 for(
SIZE_T i = 0; i < S; ++i){
796 if( (V[i] & po) != 0 &&
801 for(
SIZE_T i = 0; i < SJ; ++i){
802 if( (J_V[i] & jo) != 0 &&
803 (J_V[i] & jo) == J_V[i])
809 static inline std::string fromMatchOption(
Uint po,
Uint jo){
810 return fromOption(MJ_V, MJ_N,
sizeof(MJ_V)/
sizeof(
Uint),
811 M_V, M_N,
sizeof(M_V)/
sizeof(
Uint),
815 static inline std::string fromReplaceOption(
Uint po,
Uint jo){
816 return fromOption(RJ_V, RJ_N,
sizeof(RJ_V)/
sizeof(
Uint),
817 R_V, R_N,
sizeof(R_V)/
sizeof(
Uint),
821 static inline std::string fromCompileOption(
Uint po,
Uint jo){
822 return fromOption(CJ_V, CJ_N,
sizeof(CJ_V)/
sizeof(
Uint),
823 C_V, C_N,
sizeof(C_V)/
sizeof(
Uint),
847 void toOption(
Modifier const& mod,
bool x,
848 VecOpt const& J_V, std::string
const& J_N,
849 VecOpt const& V, std::string
const& N,
854 JPCRE2_ASSERT(SJ == J_N.length(), (
"ValueError: Modifier character and value table must be of the same size (" + _tostdstring(SJ) +
" == " + _tostdstring(J_N.length()) +
").").c_str());
855 JPCRE2_ASSERT(S == N.length(), (
"ValueError: Modifier character and value table must be of the same size (" + _tostdstring(S) +
" == " + _tostdstring(N.length()) +
").").c_str());
856 MOD::toOption(mod, x,
857 J_V.empty()?0:&J_V[0], J_N.
c_str(), SJ,
858 V.empty()?0:&V[0], N.c_str(), S,
863 std::string fromOption(
VecOpt const& J_V, std::string
const& J_N,
864 VecOpt const& V, std::string
const& N,
868 JPCRE2_ASSERT(SJ == J_N.length(), (
"ValueError: Modifier character and value table must be of the same size (" + _tostdstring(SJ) +
" == " + _tostdstring(J_N.length()) +
").").c_str());
869 JPCRE2_ASSERT(S == N.length(), (
"ValueError: Modifier character and value table must be of the same size (" + _tostdstring(S) +
" == " + _tostdstring(N.length()) +
").").c_str());
870 return MOD::fromOption(J_V.empty()?0:&J_V[0], J_N.c_str(), SJ,
871 V.empty()?0:&V[0], N.c_str(), S,
875 void parseModifierTable(std::string& tabjs,
VecOpt& tabjv,
876 std::string& tab_s,
VecOpt& tab_v,
877 std::string
const& tabs,
VecOpt const& tabv);
892 std::string().swap(tabjms);
893 std::string().swap(tabms);
902 std::string().swap(tabjrs);
903 std::string().swap(tabrs);
912 std::string().swap(tabjcs);
913 std::string().swap(tabcs);
979 toOption(mod, x,tabjmv,tabjms,tabmv, tabms,po,jo,en,eo);
990 return toOption(mod, x,tabjrv,tabjrs,tabrv,tabrs,po,jo,en,eo);
1001 return toOption(mod, x,tabjcv,tabjcs,tabcv,tabcs,po,jo,en,eo);
1009 return fromOption(tabjmv,tabjms,tabmv,tabms,po,jo);
1017 return fromOption(tabjrv,tabjrs,tabrv,tabrs,po,jo);
1025 return fromOption(tabjcv,tabjcs,tabcv,tabcs,po,jo);
1034 parseModifierTable(tabjms, tabjmv, tabms, tabmv, tabs, tabv);
1045 VecOpt tabv(tabvp, tabvp + tabs.length());
1060 if(tabsp && tabvp) {
1061 std::string tabs(tabsp);
1062 VecOpt tabv(tabvp, tabvp + tabs.length());
1074 parseModifierTable(tabjrs, tabjrv, tabrs, tabrv, tabs, tabv);
1085 VecOpt tabv(tabvp, tabvp + tabs.length());
1100 if(tabsp && tabvp) {
1101 std::string tabs(tabsp);
1102 VecOpt tabv(tabvp, tabvp + tabs.length());
1114 parseModifierTable(tabjcs, tabjcv, tabcs, tabcv, tabs, tabv);
1125 VecOpt tabv(tabvp, tabvp + tabs.length());
1140 if(tabsp && tabvp) {
1141 std::string tabs(tabsp);
1142 VecOpt tabv(tabvp, tabvp + tabs.length());
1151 tabjms = std::string(MOD::MJ_N, MOD::MJ_N +
sizeof(MOD::MJ_V)/
sizeof(
Uint));
1152 tabms = std::string(MOD::M_N, MOD::M_N +
sizeof(MOD::M_V)/
sizeof(
Uint));
1153 tabjmv =
VecOpt(MOD::MJ_V, MOD::MJ_V +
sizeof(MOD::MJ_V)/
sizeof(
Uint));
1154 tabmv =
VecOpt(MOD::M_V, MOD::M_V +
sizeof(MOD::M_V)/
sizeof(
Uint));
1161 tabjrs = std::string(MOD::RJ_N, MOD::RJ_N +
sizeof(MOD::RJ_V)/
sizeof(
Uint));
1162 tabrs = std::string(MOD::R_N, MOD::R_N +
sizeof(MOD::R_V)/
sizeof(
Uint));
1163 tabjrv =
VecOpt(MOD::RJ_V, MOD::RJ_V +
sizeof(MOD::RJ_V)/
sizeof(
Uint));
1164 tabrv =
VecOpt(MOD::R_V, MOD::R_V +
sizeof(MOD::R_V)/
sizeof(
Uint));
1171 tabjcs = std::string(MOD::CJ_N, MOD::CJ_N +
sizeof(MOD::CJ_V)/
sizeof(
Uint));
1172 tabcs = std::string(MOD::C_N, MOD::C_N +
sizeof(MOD::C_V)/
sizeof(
Uint));
1173 tabjcv =
VecOpt(MOD::CJ_V, MOD::CJ_V +
sizeof(MOD::CJ_V)/
sizeof(
Uint));
1174 tabcv =
VecOpt(MOD::C_V, MOD::C_V +
sizeof(MOD::C_V)/
sizeof(
Uint));
1191 template<
typename Char_T>
struct MSG{
1200 #if JPCRE2_USE_MINIMUM_CXX_11
1233 #if JPCRE2_USE_MINIMUM_CXX_11
1234 template<
typename Char_T,
template<
typename...>
class Map=std::map>
1236 template<
typename Char_T>
1253 typedef typename std::basic_string<Char_T>
String;
1255 #if JPCRE2_USE_MINIMUM_CXX_11
1261 typedef typename std::map<String, String>
MapNas;
1264 typedef typename std::map<String, SIZE_T>
MapNtN;
1282 typedef typename Pcre2Type<
sizeof( Char_T ) * CHAR_BIT>::Pcre2Uchar Pcre2Uchar;
1283 typedef typename Pcre2Type<
sizeof( Char_T ) * CHAR_BIT>::Pcre2Sptr Pcre2Sptr;
1284 typedef typename Pcre2Type<
sizeof( Char_T ) * CHAR_BIT>::Pcre2Code Pcre2Code;
1285 typedef typename Pcre2Type<
sizeof( Char_T ) * CHAR_BIT>::CompileContext CompileContext;
1286 typedef typename Pcre2Type<
sizeof( Char_T ) * CHAR_BIT>::MatchData MatchData;
1287 typedef typename Pcre2Type<
sizeof( Char_T ) * CHAR_BIT>::GeneralContext GeneralContext;
1288 typedef typename Pcre2Type<
sizeof( Char_T ) * CHAR_BIT>::MatchContext MatchContext;
1289 typedef typename Pcre2Type<
sizeof( Char_T ) * CHAR_BIT>::JitCallback JitCallback;
1290 typedef typename Pcre2Type<
sizeof( Char_T ) * CHAR_BIT>::JitStack JitStack;
1292 template<
typename T>
1293 static String toString(T);
1333 Pcre2Uchar buffer[
sizeof(
Char)*CHAR_BIT*1024];
1334 Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::get_error_message(err_num, buffer,
sizeof(buffer));
1335 return toString((Pcre2Uchar*) buffer);
1347 }
else if(err_num != 0) {
1356 class MatchEvaluator;
1384 String const *m_subject_ptr;
1386 Uint jpcre2_match_opts;
1387 MatchContext *mcontext;
1391 PCRE2_SIZE _start_offset;
1400 bool getNumberedSubstrings(
int, Pcre2Sptr, PCRE2_SIZE*, uint32_t);
1402 bool getNamedSubstrings(
int,
int, Pcre2Sptr, Pcre2Sptr, PCRE2_SIZE*);
1412 jpcre2_match_opts = 0;
1416 m_subject_ptr = &m_subject;
1426 m_subject_ptr = (rm.m_subject_ptr == &rm.m_subject) ? &m_subject
1431 vec_num = rm.vec_num;
1432 vec_nas = rm.vec_nas;
1433 vec_ntn = rm.vec_ntn;
1434 vec_soff = rm.vec_soff;
1435 vec_eoff = rm.vec_eoff;
1437 match_opts = rm.match_opts;
1438 jpcre2_match_opts = rm.jpcre2_match_opts;
1439 error_number = rm.error_number;
1440 error_offset = rm.error_offset;
1441 _start_offset = rm._start_offset;
1442 mcontext = rm.mcontext;
1448 m_subject = rm.m_subject;
1452 #if JPCRE2_USE_MINIMUM_CXX_11
1454 m_subject = std::move_if_noexcept(rm.m_subject);
1464 PCRE2_SIZE error_offset;
1496 if(
this == &rm)
return *
this;
1501 #if JPCRE2_USE_MINIMUM_CXX_11
1523 if(
this == &rm)
return *
this;
1538 String().swap(m_subject);
1570 return error_number;
1576 return (
int)error_offset;
1582 #if JPCRE2_USE_MINIMUM_CXX_11
1593 return *m_subject_ptr;
1601 return m_subject_ptr;
1620 return modtab ? modtab->
fromMatchOption(match_opts, jpcre2_match_opts)
1621 : MOD::fromMatchOption(match_opts, jpcre2_match_opts);
1644 return jpcre2_match_opts;
1650 return _start_offset;
1764 m_subject_ptr = &m_subject;
1775 if(s) m_subject_ptr = s;
1778 m_subject_ptr = &m_subject;
1792 jpcre2_match_opts = 0;
1811 jpcre2_match_opts = x;
1829 jpcre2_match_opts = x?jpcre2_match_opts |
FIND_ALL:jpcre2_match_opts & ~
FIND_ALL;
1847 _start_offset = offset;
1858 mcontext = match_context;
1899 modtab ? modtab->
toMatchOption(mod, x, &match_opts, &jpcre2_match_opts, &error_number, &error_offset)
1900 : MOD::toMatchOption(mod, x, &match_opts, &jpcre2_match_opts, &error_number, &error_offset);
1911 jpcre2_match_opts = x ? jpcre2_match_opts | opt : jpcre2_match_opts & ~opt;
1922 match_opts = x ? match_opts | opt : match_opts & ~opt;
1942 jpcre2_match_opts |= x;
1998 template<
typename T1,
typename T2,
typename T3>
2000 #if !defined JPCRE2_USE_FUNCTION_POINTER_CALLBACK && JPCRE2_USE_MINIMUM_CXX_11
2001 typedef std::function<
String (T1,T2,T3)> Callback;
2003 typedef String (*Callback)(T1,T2,T3);
2054 #if JPCRE2_USE_MINIMUM_CXX_11
2167 PCRE2_SIZE buffer_size;
2180 setMatchStartOffsetVector(&vec_soff);
2181 setMatchEndOffsetVector(&vec_eoff);
2185 void setVectorPointersAccordingToCallback(){
2188 case 1: setNumberedSubstringVector(&vec_num);
break;
2189 case 2: setNamedSubstringVector(&vec_nas);
break;
2190 case 3: setNumberedSubstringVector(&vec_num).setNamedSubstringVector(&vec_nas);
break;
2191 case 4: setNameToNumberMapVector(&vec_ntn);
break;
2192 case 5: setNumberedSubstringVector(&vec_num).setNameToNumberMapVector(&vec_ntn);
break;
2193 case 6: setNamedSubstringVector(&vec_nas).setNameToNumberMapVector(&vec_ntn);
break;
2194 case 7: setNumberedSubstringVector(&vec_num).setNamedSubstringVector(&vec_nas).setNameToNumberMapVector(&vec_ntn);
break;
2199 callbackn = me.callbackn;
2200 callback0 = me.callback0;
2201 callback1 = me.callback1;
2202 callback2 = me.callback2;
2203 callback3 = me.callback3;
2204 callback4 = me.callback4;
2205 callback5 = me.callback5;
2206 callback6 = me.callback6;
2207 callback7 = me.callback7;
2209 setVectorPointersAccordingToCallback();
2210 buffer_size = me.buffer_size;
2214 vec_num = me.vec_num;
2215 vec_nas = me.vec_nas;
2216 vec_ntn = me.vec_ntn;
2217 vec_soff = me.vec_soff;
2218 vec_eoff = me.vec_eoff;
2222 #if JPCRE2_USE_MINIMUM_CXX_11
2224 vec_num = std::move_if_noexcept(me.vec_num);
2225 vec_nas = std::move_if_noexcept(me.vec_nas);
2226 vec_ntn = std::move_if_noexcept(me.vec_ntn);
2227 vec_soff = std::move_if_noexcept(me.vec_soff);
2228 vec_eoff = std::move_if_noexcept(me.vec_eoff);
2388 if(
this == &me)
return *
this;
2394 #if JPCRE2_USE_MINIMUM_CXX_11
2418 if(
this == &me)
return *
this;
2449 setNumberedSubstringVector(&vec_num);
2472 setNumberedSubstringVector(&vec_num);
2473 setNamedSubstringVector(&vec_nas);
2496 setNumberedSubstringVector(&vec_num);
2497 setNameToNumberMapVector(&vec_ntn);
2521 setNumberedSubstringVector(&vec_num);
2522 setNamedSubstringVector(&vec_nas);
2523 setNameToNumberMapVector(&vec_ntn);
2546 setNamedSubstringVector(&vec_nas);
2569 setNamedSubstringVector(&vec_nas);
2570 setNameToNumberMapVector(&vec_ntn);
2593 setNameToNumberMapVector(&vec_ntn);
2901 String const *r_replw_ptr;
2903 Uint jpcre2_replace_opts;
2904 PCRE2_SIZE buffer_size;
2905 PCRE2_SIZE _start_offset;
2907 MatchContext *mcontext;
2909 SIZE_T last_replace_count;
2910 SIZE_T* last_replace_counter;
2914 r_subject_ptr = &r_subject;
2915 r_replw_ptr = &r_replw;
2916 replace_opts = PCRE2_SUBSTITUTE_OVERFLOW_LENGTH;
2917 jpcre2_replace_opts = 0;
2925 last_replace_count = 0;
2926 last_replace_counter = &last_replace_count;
2933 r_subject_ptr = (rr.r_subject_ptr == &rr.r_subject) ? &r_subject
2936 r_replw = rr.r_replw;
2938 r_replw_ptr = (rr.r_replw_ptr == &rr.r_replw) ? &r_replw
2941 replace_opts = rr.replace_opts;
2942 jpcre2_replace_opts = rr.jpcre2_replace_opts;
2943 buffer_size = rr.buffer_size;
2944 error_number = rr.error_number;
2945 error_offset = rr.error_offset;
2946 _start_offset = rr._start_offset;
2948 mcontext = rr.mcontext;
2950 last_replace_count = rr.last_replace_count;
2951 last_replace_counter = (rr.last_replace_counter == &rr.last_replace_count) ? &last_replace_count
2952 : rr.last_replace_counter;
2956 r_subject = rr.r_subject;
2960 #if JPCRE2_USE_MINIMUM_CXX_11
2962 r_subject = std::move_if_noexcept(rr.r_subject);
2971 PCRE2_SIZE error_offset;
3003 if(
this == &rr)
return *
this;
3008 #if JPCRE2_USE_MINIMUM_CXX_11
3031 if(
this == &rr)
return *
this;
3043 String().swap(r_subject);
3071 return error_number;
3077 return (
int)error_offset;
3083 #if JPCRE2_USE_MINIMUM_CXX_11
3093 return *r_replw_ptr;
3106 return *r_subject_ptr;
3113 return r_subject_ptr;
3133 : MOD::fromReplaceOption(replace_opts, jpcre2_replace_opts);
3145 return _start_offset;
3153 return replace_opts;
3161 return jpcre2_replace_opts;
3197 return *last_replace_counter;
3207 last_replace_count = 0;
3208 last_replace_counter = counter ? counter : &last_replace_count;
3229 r_subject_ptr = &r_subject;
3241 if(s) r_subject_ptr = s;
3244 r_subject_ptr = &r_subject;
3263 r_replw_ptr = &r_replw;
3272 if(s) r_replw_ptr = s;
3275 r_replw_ptr = &r_replw;
3286 replace_opts = PCRE2_SUBSTITUTE_OVERFLOW_LENGTH;
3287 jpcre2_replace_opts = 0;
3312 _start_offset = start_offset;
3323 jpcre2_replace_opts = x;
3334 replace_opts = PCRE2_SUBSTITUTE_OVERFLOW_LENGTH | x;
3345 mcontext = match_context;
3373 modtab ? modtab->
toReplaceOption(mod, x, &replace_opts, &jpcre2_replace_opts, &error_number, &error_offset)
3374 : MOD::toReplaceOption(mod, x, &replace_opts, &jpcre2_replace_opts, &error_number, &error_offset);
3386 jpcre2_replace_opts = x ? jpcre2_replace_opts | opt : jpcre2_replace_opts & ~opt;
3397 replace_opts = x ? replace_opts | opt : replace_opts & ~opt;
3419 jpcre2_replace_opts |= x;
3453 return *last_replace_counter;
3468 .setSubject(r_subject_ptr)
3475 return *last_replace_counter;
3559 String const *pat_str_ptr;
3562 Uint jpcre2_compile_opts;
3565 CompileContext *ccontext;
3566 std::vector<unsigned char> tabv;
3570 jpcre2_compile_opts = 0;
3575 pat_str_ptr = &pat_str;
3580 void freeRegexMemory(
void) {
3581 Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::code_free(code);
3585 void freeCompileContext(){
3586 Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::compile_context_free(ccontext);
3590 void onlyCopy(
Regex const &r){
3592 pat_str_ptr = (r.pat_str_ptr == &r.pat_str) ? &pat_str
3595 compile_opts = r.compile_opts;
3596 jpcre2_compile_opts = r.jpcre2_compile_opts;
3597 error_number = r.error_number;
3598 error_offset = r.error_offset;
3602 void deepCopy(
Regex const &r) {
3603 pat_str = r.pat_str;
3610 freeCompileContext();
3611 ccontext = (r.ccontext) ? Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::compile_context_copy(r.ccontext) : 0;
3613 if(ccontext && !tabv.empty()) Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::set_character_tables(ccontext, &tabv[0]);
3619 : freeRegexMemory();
3622 #if JPCRE2_USE_MINIMUM_CXX_11
3624 void deepMove(
Regex& r) {
3625 pat_str = std::move_if_noexcept(r.pat_str);
3630 tabv = std::move_if_noexcept(r.tabv);
3633 freeCompileContext();
3634 ccontext = r.ccontext; r.ccontext = 0;
3635 if(ccontext && !tabv.empty()) Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::set_character_tables(ccontext, &tabv[0]);
3639 code = r.code; r.code = 0;
3647 PCRE2_SIZE error_offset;
3737 if (
this == &r)
return *
this;
3743 #if JPCRE2_USE_MINIMUM_CXX_11
3767 if (
this == &r)
return *
this;
3794 explicit operator bool()
const {
3830 freeCompileContext();
3837 freeCompileContext();
3847 freeCompileContext();
3871 const unsigned char* tables = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::maketables(0);
3872 tabv = std::vector<unsigned char>(tables, tables+1088);
3873 ::free((
void*)tables);
3875 ccontext = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::compile_context_create(0);
3876 Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::set_character_tables(ccontext, &tabv[0]);
3889 return *pat_str_ptr;
3913 : MOD::fromCompileOption(compile_opts, jpcre2_compile_opts);
3921 return compile_opts;
3929 return jpcre2_compile_opts;
3935 return error_number;
3941 return (
int)error_offset;
3947 #if JPCRE2_USE_MINIMUM_CXX_11
3966 int ret = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::pattern_info(code, PCRE2_INFO_NEWLINE, &newline);
3967 if(ret < 0) error_number = ret;
3990 ccontext = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::compile_context_create(0);
3991 int ret = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::set_newline(ccontext, value);
3992 if(ret < 0) error_number = ret;
4001 pat_str_ptr = &pat_str;
4009 if(re) pat_str_ptr = re;
4012 pat_str_ptr = &pat_str;
4026 jpcre2_compile_opts = 0;
4044 jpcre2_compile_opts = x;
4071 modtab ? modtab->
toCompileOption(mod, x, &compile_opts, &jpcre2_compile_opts, &error_number, &error_offset)
4072 : MOD::toCompileOption(mod, x, &compile_opts, &jpcre2_compile_opts, &error_number, &error_offset);
4083 jpcre2_compile_opts = x ? jpcre2_compile_opts | opt : jpcre2_compile_opts & ~opt;
4094 compile_opts = x ? compile_opts | opt : compile_opts & ~opt;
4115 jpcre2_compile_opts |= x;
4209 rm.setModifierTable(modtab);
4266 rr.setModifierTable(modtab);
4391 #if JPCRE2_USE_MINIMUM_CXX_11
4399 inline void jpcre2::ModifierTable::parseModifierTable(std::string& tabjs,
VecOpt& tabjv,
4400 std::string& tab_s,
VecOpt& tab_v,
4401 std::string
const& tabs,
VecOpt const& tabv){
4402 SIZE_T n = tabs.length();
4403 JPCRE2_ASSERT(n == tabv.size(), (
"ValueError: Could not set Modifier table.\
4404 Modifier character and value tables are not of the same size (" + _tostdstring(n) +
" == " + _tostdstring(tabv.size()) +
").").c_str());
4406 tab_s.clear(); tab_s.reserve(n);
4408 tab_v.clear(); tab_v.reserve(n);
4413 tabjs.push_back(tabs[i]); tabjv.push_back(tabv[i]);
break;
4414 default: tab_s.push_back(tabs[i]); tab_v.push_back(tabv[i]);
break;
4420 #if JPCRE2_USE_MINIMUM_CXX_11
4421 template<
typename Char_T,
template<
typename...>
class Map>
4424 template<
typename Char_T>
4428 Pcre2Sptr c_pattern = (Pcre2Sptr) pat_str_ptr->c_str();
4430 PCRE2_SIZE err_offset = 0;
4439 code = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::compile( c_pattern,
4440 PCRE2_ZERO_TERMINATED,
4449 error_number = err_number;
4450 error_offset = err_offset;
4452 }
else if ((jpcre2_compile_opts &
JIT_COMPILE) != 0) {
4454 int jit_ret = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::jit_compile(code, PCRE2_JIT_COMPLETE);
4455 if(jit_ret < 0) error_number = jit_ret;
4461 #if JPCRE2_USE_MINIMUM_CXX_11
4462 template<
typename Char_T,
template<
typename...>
class Map>
4465 template<
typename Char_T>
4468 if(counter) *counter = 0;
4470 replace_opts |= PCRE2_SUBSTITUTE_OVERFLOW_LENGTH;
4471 replace_opts &= ~PCRE2_SUBSTITUTE_GLOBAL;
4472 Regex const * re = RegexMatch::getRegexObject();
4474 if (!re || re->code == 0)
4475 return RegexMatch::getSubject();
4477 Pcre2Sptr r_subject_ptr = (Pcre2Sptr) RegexMatch::getSubjectPointer()->c_str();
4480 if(do_match) match();
4481 SIZE_T mcount = vec_soff.size();
4483 if(!mcount)
return RegexMatch::getSubject();
4484 SIZE_T current_offset = 0;
4488 SIZE_T last = vec_eoff.size();
4489 last = (last>0)?last-1:0;
4490 JPCRE2_ASSERT(vec_eoff[last] <= RegexMatch::getSubject().size(),
"ValueError: subject string is not of the required size, may be it's changed!!!\
4491 If you are using esisting match data, try a new match.");
4494 for(
SIZE_T i=0;i<mcount;++i){
4497 if(vec_soff[i] < current_offset || vec_eoff[i] < vec_soff[i]){
4498 RegexMatch::error_number = PCRE2_ERROR_BADSUBSPATTERN;
4499 return RegexMatch::getSubject();
4502 res +=
String(r_subject_ptr+current_offset, r_subject_ptr+vec_soff[i]);
4506 case 0: tmp = callback0((
void*)0, (
void*)0, (
void*)0);
break;
4507 case 1: JPCRE2_VECTOR_DATA_ASSERT(vec_num.size() == mcount,
"VecNum");
4508 tmp = callback1(vec_num[i], (
void*)0, (
void*)0);
break;
4509 case 2: JPCRE2_VECTOR_DATA_ASSERT(vec_nas.size() == mcount,
"VecNas");
4510 tmp = callback2((
void*)0, vec_nas[i], (
void*)0);
break;
4511 case 3: JPCRE2_VECTOR_DATA_ASSERT(vec_num.size() == mcount && vec_nas.size() == mcount,
"VecNum or VecNas");
4512 tmp = callback3(vec_num[i], vec_nas[i], (
void*)0);
break;
4513 case 4: JPCRE2_VECTOR_DATA_ASSERT(vec_ntn.size() == mcount,
"VecNtn");
4514 tmp = callback4((
void*)0, (
void*)0, vec_ntn[i]);
break;
4515 case 5: JPCRE2_VECTOR_DATA_ASSERT(vec_num.size() == mcount && vec_ntn.size() == mcount,
"VecNum or VecNtn");
4516 tmp = callback5(vec_num[i], (
void*)0, vec_ntn[i]);
break;
4517 case 6: JPCRE2_VECTOR_DATA_ASSERT(vec_nas.size() == mcount && vec_ntn.size() == mcount,
"VecNas or VecNtn");
4518 tmp = callback6((
void*)0, vec_nas[i], vec_ntn[i]);
break;
4519 case 7: JPCRE2_VECTOR_DATA_ASSERT(vec_num.size() == mcount && vec_nas.size() == mcount && vec_ntn.size() == mcount,
"VecNum\n or VecNas or VecNtn");
4520 tmp = callback7(vec_num[i], vec_nas[i], vec_ntn[i]);
break;
4521 default:
JPCRE2_ASSERT(2 == 1,
"Invalid callbackn. Please file a bug report (must include the line number from below).");
break;
4524 current_offset = vec_eoff[i];
4530 Pcre2Sptr subject = r_subject_ptr + vec_soff[i];
4531 PCRE2_SIZE subject_length = vec_eoff[i] - vec_soff[i];
4534 Pcre2Sptr replace = (Pcre2Sptr) tmp.c_str();
4535 PCRE2_SIZE replace_length = tmp.length();
4538 PCRE2_SIZE outlengthptr = 0;
4539 Pcre2Uchar* output_buffer =
new Pcre2Uchar[outlengthptr + 1]();
4542 ret = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::substitute(
4549 RegexMatch::mcontext,
4558 if ((replace_opts & PCRE2_SUBSTITUTE_OVERFLOW_LENGTH) != 0
4559 && ret == (
int) PCRE2_ERROR_NOMEMORY && retry) {
4563 delete[] output_buffer;
4564 output_buffer =
new Pcre2Uchar[outlengthptr + 1]();
4568 RegexMatch::error_number = ret;
4569 delete[] output_buffer;
4570 return RegexMatch::getSubject();
4576 res +=
String((
Char*) output_buffer,(
Char*) (output_buffer + outlengthptr) );
4577 delete[] output_buffer;
4578 if(counter) *counter += ret;
4580 if((RegexMatch::getJpcre2Option() &
FIND_ALL) == 0)
break;
4584 res += RegexMatch::getSubject().substr(current_offset, String::npos);
4589 #if JPCRE2_USE_MINIMUM_CXX_11
4590 template<
typename Char_T,
template<
typename...>
class Map>
4593 template<
typename Char_T>
4596 if(counter) *counter = 0;
4597 if(do_match) match();
4598 SIZE_T mcount = vec_soff.size();
4600 if(!mcount)
return RegexMatch::getSubject();
4601 SIZE_T current_offset = 0;
4605 SIZE_T last = vec_eoff.size();
4606 last = (last>0)?last-1:0;
4607 JPCRE2_ASSERT(vec_eoff[last] <= RegexMatch::getSubject().size(),
"ValueError: subject string is not of the required size, may be it's changed!!!\
4608 If you are using esisting match data, try a new match.");
4611 for(
SIZE_T i=0;i<mcount;++i){
4614 if(vec_soff[i] < current_offset){
4615 RegexMatch::error_number = PCRE2_ERROR_BADSUBSPATTERN;
4616 return RegexMatch::getSubject();
4618 res += RegexMatch::getSubject().substr(current_offset, vec_soff[i]-current_offset);
4622 case 0: res += callback0((
void*)0, (
void*)0, (
void*)0);
break;
4623 case 1: JPCRE2_VECTOR_DATA_ASSERT(vec_num.size() == mcount,
"VecNum");
4624 res += callback1(vec_num[i], (
void*)0, (
void*)0);
break;
4625 case 2: JPCRE2_VECTOR_DATA_ASSERT(vec_nas.size() == mcount,
"VecNas");
4626 res += callback2((
void*)0, vec_nas[i], (
void*)0);
break;
4627 case 3: JPCRE2_VECTOR_DATA_ASSERT(vec_num.size() == mcount && vec_nas.size() == mcount,
"VecNum or VecNas");
4628 res += callback3(vec_num[i], vec_nas[i], (
void*)0);
break;
4629 case 4: JPCRE2_VECTOR_DATA_ASSERT(vec_ntn.size() == mcount,
"VecNtn");
4630 res += callback4((
void*)0, (
void*)0, vec_ntn[i]);
break;
4631 case 5: JPCRE2_VECTOR_DATA_ASSERT(vec_num.size() == mcount && vec_ntn.size() == mcount,
"VecNum or VecNtn");
4632 res += callback5(vec_num[i], (
void*)0, vec_ntn[i]);
break;
4633 case 6: JPCRE2_VECTOR_DATA_ASSERT(vec_nas.size() == mcount && vec_ntn.size() == mcount,
"VecNas or VecNtn");
4634 res += callback6((
void*)0, vec_nas[i], vec_ntn[i]);
break;
4635 case 7: JPCRE2_VECTOR_DATA_ASSERT(vec_num.size() == mcount && vec_nas.size() == mcount && vec_ntn.size() == mcount,
"VecNum\n or VecNas or VecNtn");
4636 res += callback7(vec_num[i], vec_nas[i], vec_ntn[i]);
break;
4637 default:
JPCRE2_ASSERT(2 == 1,
"Invalid callbackn. Please file a bug report (must include the line number from below).");
break;
4640 current_offset = vec_eoff[i];
4641 if(counter) *counter += 1;
4643 if((RegexMatch::getJpcre2Option() &
FIND_ALL) == 0)
break;
4647 res += RegexMatch::getSubject().substr(current_offset, String::npos);
4652 #if JPCRE2_USE_MINIMUM_CXX_11
4653 template<
typename Char_T,
template<
typename...>
class Map>
4656 template<
typename Char_T>
4659 *last_replace_counter = 0;
4662 if (!re || re->code == 0)
4663 return *r_subject_ptr;
4665 Pcre2Sptr subject = (Pcre2Sptr) r_subject_ptr->c_str();
4666 PCRE2_SIZE subject_length = r_subject_ptr->length();
4667 Pcre2Sptr replace = (Pcre2Sptr) r_replw_ptr->c_str();
4668 PCRE2_SIZE replace_length = r_replw_ptr->length();
4669 PCRE2_SIZE outlengthptr = (PCRE2_SIZE) buffer_size;
4672 Pcre2Uchar* output_buffer =
new Pcre2Uchar[outlengthptr + 1]();
4675 ret = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::substitute(
4691 if ((replace_opts & PCRE2_SUBSTITUTE_OVERFLOW_LENGTH) != 0
4692 && ret == (
int) PCRE2_ERROR_NOMEMORY && retry) {
4696 delete[] output_buffer;
4697 output_buffer =
new Pcre2Uchar[outlengthptr + 1]();
4702 delete[] output_buffer;
4703 return *r_subject_ptr;
4709 *last_replace_counter += ret;
4711 delete[] output_buffer;
4716 #if JPCRE2_USE_MINIMUM_CXX_11
4717 template<
typename Char_T,
template<
typename...>
class Map>
4720 template<
typename Char_T>
4725 num_sub.reserve(rcu);
4727 for (i = 0u; i < rcu; i++)
4728 num_sub.push_back(
String((
Char*)(subject + ovector[2*i]), ovector[2*i+1] - ovector[2*i]));
4729 for (uint32_t j = i; j < ovector_count; j++)
4730 num_sub.push_back(
String());
4731 vec_num->push_back(num_sub);
4736 #if JPCRE2_USE_MINIMUM_CXX_11
4737 template<
typename Char_T,
template<
typename...>
class Map>
4739 Pcre2Sptr name_table,
4740 Pcre2Sptr subject, PCRE2_SIZE* ovector ) {
4742 template<
typename Char_T>
4744 Pcre2Sptr name_table,
4745 Pcre2Sptr subject, PCRE2_SIZE* ovector ) {
4747 Pcre2Sptr tabptr = name_table;
4751 for (
int i = 0; i < namecount; i++) {
4753 if(
sizeof( Char_T ) * CHAR_BIT == 8){
4754 n = (int)((tabptr[0] << 8) | tabptr[1]);
4755 key = toString((
Char*) (tabptr + 2));
4759 key = toString((
Char*) (tabptr + 1));
4762 tabptr += name_entry_size;
4763 String value((
Char*)(subject + ovector[2*n]), ovector[2*n+1] - ovector[2*n]);
4764 if(vec_nas) map_nas[key] = value;
4765 if(vec_ntn) map_ntn[key] = n;
4768 if(vec_nas) vec_nas->push_back(map_nas);
4769 if(vec_ntn) vec_ntn->push_back(map_ntn);
4774 #if JPCRE2_USE_MINIMUM_CXX_11
4775 template<
typename Char_T,
template<
typename...>
class Map>
4778 template<
typename Char_T>
4783 if (!re || re->code == 0)
4786 Pcre2Sptr subject = (Pcre2Sptr) m_subject_ptr->c_str();
4787 Pcre2Sptr name_table = 0;
4788 int crlf_is_newline = 0;
4790 int name_entry_size = 0;
4792 uint32_t ovector_count = 0;
4797 PCRE2_SIZE *ovector = 0;
4798 SIZE_T subject_length = 0;
4799 MatchData *match_data = 0;
4800 subject_length = m_subject_ptr->length();
4804 if (vec_num) vec_num->clear();
4805 if (vec_nas) vec_nas->clear();
4806 if (vec_ntn) vec_ntn->clear();
4807 if(vec_soff) vec_soff->clear();
4808 if(vec_eoff) vec_eoff->clear();
4813 if(mdata) match_data = mdata;
4815 match_data = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::match_data_create_from_pattern(re->code, 0);
4819 rc = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::match( re->code,
4831 Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::match_data_free(match_data);
4834 case PCRE2_ERROR_NOMATCH:
4848 ovector = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::get_ovector_pointer(match_data);
4849 ovector_count = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::get_ovector_count(match_data);
4867 if(vec_soff) vec_soff->push_back(ovector[0]);
4868 if(vec_eoff) vec_eoff->push_back(ovector[1]);
4872 if(!getNumberedSubstrings(rc, subject, ovector, ovector_count))
4877 if (vec_nas || vec_ntn) {
4881 (void) Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::pattern_info( re->code,
4882 PCRE2_INFO_NAMECOUNT,
4885 if (namecount <= 0);
4891 (void) Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::pattern_info( re->code,
4892 PCRE2_INFO_NAMETABLE,
4895 (void) Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::pattern_info( re->code,
4896 PCRE2_INFO_NAMEENTRYSIZE,
4908 if(!getNamedSubstrings(namecount, name_entry_size, name_table, subject, ovector))
4941 if ((jpcre2_match_opts &
FIND_ALL) == 0) {
4943 Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::match_data_free(match_data);
4952 (void) Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::pattern_info(re->code, PCRE2_INFO_ALLOPTIONS, &option_bits);
4953 utf = ((option_bits & PCRE2_UTF) != 0);
4958 (void) Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::pattern_info(re->code, PCRE2_INFO_NEWLINE, &newline);
4959 crlf_is_newline = newline == PCRE2_NEWLINE_ANY
4960 || newline == PCRE2_NEWLINE_CRLF
4961 || newline == PCRE2_NEWLINE_ANYCRLF;
4967 Uint options = match_opts;
4968 PCRE2_SIZE start_offset = ovector[1];
4974 if (ovector[0] == ovector[1]) {
4975 if (ovector[0] == subject_length)
4977 options |= PCRE2_NOTEMPTY_ATSTART | PCRE2_ANCHORED;
4982 rc = Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::match( re->code,
5003 if (rc == PCRE2_ERROR_NOMATCH) {
5006 ovector[1] = start_offset + 1;
5007 if (crlf_is_newline &&
5008 start_offset < subject_length - 1 &&
5009 subject[start_offset] ==
'\r' && subject[start_offset + 1] ==
'\n')
5012 while (ovector[1] < subject_length) {
5013 if(
sizeof( Char_T ) * CHAR_BIT == 8 && (subject[ovector[1]] & 0xc0) != 0x80)
break;
5014 else if(
sizeof( Char_T ) * CHAR_BIT == 16 && (subject[ovector[1]] & 0xfc00) != 0xdc00)
break;
5015 else if(
sizeof( Char_T ) * CHAR_BIT == 32)
break;
5026 Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::match_data_free(match_data);
5044 if(vec_soff) vec_soff->push_back(ovector[0]);
5045 if(vec_eoff) vec_eoff->push_back(ovector[1]);
5052 if(!getNumberedSubstrings(rc, subject, ovector, ovector_count))
5056 if (vec_nas || vec_ntn) {
5058 if(!getNamedSubstrings(namecount, name_entry_size, name_table, subject, ovector))
5064 Pcre2Func<
sizeof( Char_T ) * CHAR_BIT>::match_data_free(match_data);
5069 #undef JPCRE2_VECTOR_DATA_ASSERT
5070 #undef JPCRE2_UNUSED
5071 #undef JPCRE2_USE_MINIMUM_CXX_11
5078 #ifndef JPCRE2_USE_FUNCTION_POINTER_CALLBACK
5079 #define JPCRE2_USE_FUNCTION_POINTER_CALLBACK
5082 #ifndef JPCRE2_NDEBUG
5083 #define JPCRE2_NDEBUG
ModifierTable & setMatchModifierTable(const char *tabsp, const Uint *tabvp)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:1059
String replace(String const &mains, String const &repl, Modifier const &mod="", SIZE_T *counter=0)
Perform regex replace and return the replaced string using a temporary replace object.
Definition: jpcre2.hpp:4285
ModifierTable(bool deflt)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:885
Uint getJpcre2Option() const
Get JPCRE2 option.
Definition: jpcre2.hpp:3928
virtual RegexMatch & setMatchEndOffsetVector(VecOff *v)
Set the pointer to a vector to store the offsets where matches end in the subject.
Definition: jpcre2.hpp:1752
virtual RegexMatch & setNameToNumberMapVector(VecNtN *v)
Set a pointer to the name to number map vector.
Definition: jpcre2.hpp:1732
static void jassert(bool cond, const char *msg, const char *f, size_t line)
JPCRE2 assert function.
Definition: jpcre2.hpp:176
ModifierTable const * getModifierTable()
Get the modifier table that is set,.
Definition: jpcre2.hpp:3973
ModifierTable()
Default constructor that creates an empty modifier table.
Definition: jpcre2.hpp:881
virtual RegexMatch & changeModifier(Modifier const &mod, bool x)
Parse modifier and add/remove equivalent PCRE2 and JPCRE2 options.
Definition: jpcre2.hpp:1898
Regex & reset()
Reset all class variables to its default (initial) state including memory.
Definition: jpcre2.hpp:3835
virtual RegexMatch & addPcre2Option(Uint x)
Add option to existing PCRE2 options for match.
Definition: jpcre2.hpp:1951
virtual RegexMatch & changeJpcre2Option(Uint opt, bool x)
Add or remove a JPCRE2 option.
Definition: jpcre2.hpp:1910
MatchEvaluator & changePcre2Option(Uint opt, bool x)
Call RegexMatch::changePcre2Option(Uint opt, bool x).
Definition: jpcre2.hpp:2785
MatchContext * getMatchContext()
Return pointer to the match context that was previously set with setMatchContext().
Definition: jpcre2.hpp:3174
RegexReplace getReplaceObject()
Synonym for initReplace()
Definition: jpcre2.hpp:4272
Uint getNewLine()
Get new line convention from compiled code.
Definition: jpcre2.hpp:3963
RegexReplace & setJpcre2Option(Uint x)
Set JPCRE2 option for replace (overwrite existing option)
Definition: jpcre2.hpp:3322
virtual RegexMatch & setNamedSubstringVector(VecNas *v)
Set a pointer to the named substring vector.
Definition: jpcre2.hpp:1721
RegexMatch getMatchObject()
Synonym for initMatch()
Definition: jpcre2.hpp:4215
RegexReplace & resetErrors()
Reset replace related errors to zero.
Definition: jpcre2.hpp:3062
virtual VecNum const * getNumberedSubstringVector() const
Get pointer to numbered substring vector.
Definition: jpcre2.hpp:1678
void toMatchOption(Modifier const &mod, bool x, Uint *po, Uint *jo, int *en, SIZE_T *eo) const
Modifier parser for match related options.
Definition: jpcre2.hpp:978
MatchEvaluator & setSubject(String const *s)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2670
SIZE_T match(String const &s, Modifier const &mod, PCRE2_SIZE start_offset=0)
Perform regex match and return match count using a temporary match object.
Definition: jpcre2.hpp:4227
virtual Regex const * getRegexObject() const
Get a pointer to the associated Regex object.
Definition: jpcre2.hpp:1672
void compile(String const *re, Modifier const &mod)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4184
SIZE_T preplace(String *mains, String const &repl, Modifier const &mod="")
Perl compatible replace method.
Definition: jpcre2.hpp:4332
void compile(String const &re, Uint po)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4160
virtual RegexMatch & addModifier(Modifier const &mod)
Parse modifier string and add equivalent PCRE2 and JPCRE2 options.
Definition: jpcre2.hpp:1932
MatchEvaluator & clearMatchData()
Clear match data.
Definition: jpcre2.hpp:2602
Regex & resetCharacterTables()
Recreate character tables used by PCRE2.
Definition: jpcre2.hpp:3870
RegexReplace & changePcre2Option(Uint opt, bool x)
Add or remove a PCRE2 option.
Definition: jpcre2.hpp:3396
static const char VERSION_MINOR[]
Minor version, includes bug fix or minor feature upgrade.
Definition: jpcre2.hpp:124
ModifierTable & resetCompileModifierTable()
Reset the compile modifier table to its initial (empty) state including memory.
Definition: jpcre2.hpp:911
ModifierTable & clear()
Clear the modifier tables to their initial (empty) state.
Definition: jpcre2.hpp:964
RegexReplace & setModifierTable(ModifierTable const *mdt)
Set a custom modifier table to be used.
Definition: jpcre2.hpp:3294
virtual MatchContext * getMatchContext()
Return pointer to the match context that was previously set with setMatchContext().
Definition: jpcre2.hpp:1865
ModifierTable & setMatchModifierTable(std::string const &tabs, const Uint *tabvp)
Set modifier table for match.
Definition: jpcre2.hpp:1043
virtual RegexMatch & setMatchDataBlock(MatchData *madt)
Set the match data block to be used.
Definition: jpcre2.hpp:1874
MatchEvaluator & setRegexObject(Regex const *r)
Call RegexMatch::setRegexObject(r).
Definition: jpcre2.hpp:2654
ModifierTable & reset()
Reset the modifier tables to their initial (empty) state including memory.
Definition: jpcre2.hpp:921
SIZE_T match(String const *s, Modifier const &mod, PCRE2_SIZE start_offset=0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4237
virtual RegexMatch & setSubject(String const &s)
Set the subject string for match.
Definition: jpcre2.hpp:1762
MatchEvaluator & operator=(MatchEvaluator const &me)
Overloaded copy-assignment operator.
Definition: jpcre2.hpp:2387
static String fill(NumSub const &num, MapNas const &nas, MapNtn const &ntn)
Callback function for populating match vectors that does not modify the subject string.
Definition: jpcre2.hpp:2046
ModifierTable & setCompileModifierTable(std::string const &tabs, VecOpt const &tabv)
Set modifier table for compile.
Definition: jpcre2.hpp:1113
virtual Uint getPcre2Option() const
Get PCRE2 option.
Definition: jpcre2.hpp:1635
virtual RegexMatch & setModifierTable(ModifierTable const *mdt)
Set a custom modifier table to be used.
Definition: jpcre2.hpp:1800
MatchEvaluator & resetMatchData()
Reset match data to initial state.
Definition: jpcre2.hpp:2615
String nreplace(bool do_match=true, Uint jro=0, SIZE_T *counter=0)
Perform regex replace with this match evaluator.
Definition: jpcre2.hpp:4591
int getErrorNumber() const
Returns the last error number.
Definition: jpcre2.hpp:3934
MatchEvaluator & setStartOffset(PCRE2_SIZE offset)
Call RegexMatch::setStartOffset (PCRE2_SIZE offset).
Definition: jpcre2.hpp:2725
RegexReplace & operator=(RegexReplace const &rr)
Overloaded Copy assignment operator.
Definition: jpcre2.hpp:3002
Regex & setPcre2Option(Uint x)
Set PCRE2 option for compile (overwrites existing option)
Definition: jpcre2.hpp:4053
RegexReplace & setReplaceCounter(SIZE_T *counter)
Set an external counter variable to store the replacement count.
Definition: jpcre2.hpp:3206
MatchEvaluator(typename MatchEvaluatorCallback< NumSub const &, void *, MapNtN const & >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2325
RegexReplace & setMatchDataBlock(MatchData *match_data)
Set the match data block to be used.
Definition: jpcre2.hpp:3355
MatchEvaluator & addModifier(Modifier const &mod)
Call RegexMatch::addModifier(Modifier const& mod).
Definition: jpcre2.hpp:2793
VecNtN VecNtn
Allow spelling mistake of VecNtN as VecNtn.
Definition: jpcre2.hpp:1277
virtual std::string getModifier() const
Calculate modifier string from PCRE2 and JPCRE2 options and return it.
Definition: jpcre2.hpp:1619
@ NONE
Option 0 (zero)
Definition: jpcre2.hpp:152
MatchEvaluator & setCallback(typename MatchEvaluatorCallback< void *, void *, void * >::Callback mef)
Member function to set a callback function with no vector reference.
Definition: jpcre2.hpp:2434
ModifierTable & setReplaceModifierTable(std::string const &tabs, const Uint *tabvp)
Set modifier table for replace.
Definition: jpcre2.hpp:1083
class Map< String, SIZE_T > MapNtN
Substring name to Substring number map.
Definition: jpcre2.hpp:1259
String getErrorMessage() const
Returns the last error message.
Definition: jpcre2.hpp:3082
MatchEvaluator & setSubject(String const &s)
Call RegexMatch::setSubject(String const &s).
Definition: jpcre2.hpp:2662
ModifierTable & setMatchModifierTable(std::string const &tabs, VecOpt const &tabv)
Set modifier table for match.
Definition: jpcre2.hpp:1033
RegexReplace & setSubject(String *s)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3240
static const char VERSION_MAJOR[]
Major version, updated when API change is made.
Definition: jpcre2.hpp:123
String replace(void)
Perform regex replace by retrieving subject string, replacement string, modifier and other options fr...
Definition: jpcre2.hpp:4654
PCRE2_SIZE getBufferSize()
Get the initial buffer size that is being used by internal function pcre2_substitute.
Definition: jpcre2.hpp:3187
static const char VERSION_GENRE[]
Generation, depends on original PCRE2 version.
Definition: jpcre2.hpp:122
static const char FULL_VERSION[]
Full version string.
Definition: jpcre2.hpp:121
virtual RegexMatch & setRegexObject(Regex const *r)
Set the associated regex object.
Definition: jpcre2.hpp:1699
MatchEvaluator & operator=(MatchEvaluator &&me)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2417
RegexMatch(RegexMatch const &rm)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:1487
Regex & setPattern(String const &re)
Set the pattern string to compile.
Definition: jpcre2.hpp:3999
Regex & operator=(Regex &&r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3766
RegexMatch(Regex const *r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:1478
Regex & addModifier(Modifier const &mod)
Parse modifier string and add equivalent PCRE2 and JPCRE2 options.
Definition: jpcre2.hpp:4105
void compile(String const *re, Uint po, Uint jo)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4152
Regex & operator=(Regex const &r)
Overloaded assignment operator.
Definition: jpcre2.hpp:3736
MatchEvaluator & setMatchContext(MatchContext *match_context)
Call RegexMatch::setMatchContext(MatchContext *match_context).
Definition: jpcre2.hpp:2733
RegexMatch initMatch()
Returns a default constructed RegexMatch object by value.
Definition: jpcre2.hpp:4207
SIZE_T getLastReplaceCount()
Get the number of replacement in last replace operation.
Definition: jpcre2.hpp:3196
String replace(String *mains, String const &repl, Modifier const &mod="", SIZE_T *counter=0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4296
void compile(String const &re)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4191
String getReplaceWith() const
Get replacement string.
Definition: jpcre2.hpp:3092
MatchEvaluator & setFindAll()
Call RegexMatch::setFindAll().
Definition: jpcre2.hpp:2717
String replace(MatchEvaluator me)
PCRE2 compatible replace function that takes a MatchEvaluator.
Definition: jpcre2.hpp:3523
static String toString(Pcre2Uchar *a)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:1325
@ INVALID_MODIFIER
Invalid modifier was detected.
Definition: jpcre2.hpp:143
virtual RegexMatch & reset()
Reset all class variables to its default (initial) state including memory.
Definition: jpcre2.hpp:1537
static String getPcre2ErrorMessage(int err_num)
Retruns error message from PCRE2 error number.
Definition: jpcre2.hpp:1332
int getErrorOffset() const
Returns the last error offset.
Definition: jpcre2.hpp:3076
ModifierTable & resetReplaceModifierTable()
Reset the replace modifier table to its initial (empty) state including memory.
Definition: jpcre2.hpp:901
MatchEvaluator & setJpcre2Option(Uint x)
Call RegexMatch::setJpcre2Option(Uint x).
Definition: jpcre2.hpp:2694
SIZE_T match(String const *s, PCRE2_SIZE start_offset=0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4257
RegexReplace()
Default constructor.
Definition: jpcre2.hpp:2976
virtual String getSubject() const
Get subject string (by value).
Definition: jpcre2.hpp:1592
PCRE2_SIZE SIZE_T
Used for match count and vector size.
Definition: jpcre2.hpp:129
String replace(String *mains, String const *repl, Modifier const &mod="", SIZE_T *counter=0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4320
MatchEvaluator & addJpcre2Option(Uint x)
Call RegexMatch::addJpcre2Option(Uint x).
Definition: jpcre2.hpp:2801
MatchEvaluator & reset()
Reset MatchEvaluator to initial state including memory.
Definition: jpcre2.hpp:2627
static String eraseFill(NumSub const &num, MapNas const &nas, MapNtN const &ntn)
Callback function that removes the matched part/s in the subject string and takes all match vectors a...
Definition: jpcre2.hpp:2022
MatchEvaluator(typename MatchEvaluatorCallback< void *, MapNas const &, MapNtN const & >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2356
Regex(String const *re, Modifier const &mod)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3683
Lets you create custom modifier tables.
Definition: jpcre2.hpp:832
MatchEvaluator(typename MatchEvaluatorCallback< void *, void *, MapNtN const & >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2368
RegexReplace & setMatchContext(MatchContext *match_context)
Set the match context to be used.
Definition: jpcre2.hpp:3344
RegexReplace & setReplaceWith(String const &s)
Set the replacement string.
Definition: jpcre2.hpp:3261
virtual ModifierTable const * getModifierTable()
Get the modifier table that is set,.
Definition: jpcre2.hpp:1626
MatchEvaluator & setCallback(typename MatchEvaluatorCallback< NumSub const &, void *, void * >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2446
Uint getPcre2Option() const
Get PCRE2 option.
Definition: jpcre2.hpp:3920
Regex(String const &re, Modifier const &mod)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3675
This class contains a typedef of a function pointer or a templated function wrapper (std::function) t...
Definition: jpcre2.hpp:1999
String nreplace(MatchEvaluator me)
JPCRE2 native replace function.
Definition: jpcre2.hpp:3505
Regex & setNewLine(Uint value)
Set new line convention.
Definition: jpcre2.hpp:3988
MatchEvaluator & setCallback(typename MatchEvaluatorCallback< void *, MapNas const &, void * >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2543
void compile(String const &re, Modifier const &mod)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4176
void compile(String const *re, Uint po)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4168
MatchEvaluator & setCallback(typename MatchEvaluatorCallback< NumSub const &, void *, MapNtN const & >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2493
MapNtN MapNtn
Allow spelling mistake of MapNtN as MapNtn.
Definition: jpcre2.hpp:1268
RegexReplace(Regex const *r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2985
Regex & changePcre2Option(Uint opt, bool x)
Add or remove a PCRE2 option.
Definition: jpcre2.hpp:4093
SIZE_T preplace(String const &mains, String const *repl, Modifier const &mod="")
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4380
void compile(String const &re, Uint po, Uint jo)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4142
virtual RegexMatch & setModifier(Modifier const &s)
Set the modifier (resets all JPCRE2 and PCRE2 options) by calling RegexMatch::changeModifier().
Definition: jpcre2.hpp:1790
Regex & addPcre2Option(Uint x)
Add option to existing PCRE2 options for compile.
Definition: jpcre2.hpp:4124
std::vector< NumSub > VecNum
Vector of matches with numbered substrings.
Definition: jpcre2.hpp:1279
MatchEvaluator()
Default constructor.
Definition: jpcre2.hpp:2272
RegexReplace(RegexReplace const &rr)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2994
std::string fromCompileOption(Uint po, Uint jo) const
Take compile related option value and convert to modifier string.
Definition: jpcre2.hpp:1024
String replace(bool do_match=true, Uint ro=0, SIZE_T *counter=0)
PCRE2 compatible replace function that uses this MatchEvaluator.
Definition: jpcre2.hpp:4463
RegexReplace & setBufferSize(PCRE2_SIZE x)
Set the initial buffer size to be allocated for replaced string (used by PCRE2)
Definition: jpcre2.hpp:3302
Regex & clear()
Clear all class variables to its default (initial) state (some memory may retain for further use).
Definition: jpcre2.hpp:3845
void toReplaceOption(Modifier const &mod, bool x, Uint *po, Uint *jo, int *en, SIZE_T *eo) const
Modifier parser for replace related options.
Definition: jpcre2.hpp:989
virtual MatchData * getMatchDataBlock()
Get the pointer to the match data block that was set previously with setMatchData() Handling memory i...
Definition: jpcre2.hpp:3181
Provides public constructors to create RegexReplace objects.
Definition: jpcre2.hpp:2890
std::string str() const
Returns the modifier string.
Definition: jpcre2.hpp:651
@ JIT_COMPILE
Perform JIT compilation for optimization.
Definition: jpcre2.hpp:154
virtual int getErrorNumber() const
Returns the last error number.
Definition: jpcre2.hpp:1569
virtual RegexMatch & setJpcre2Option(Uint x)
Set JPCRE2 option for match (resets all)
Definition: jpcre2.hpp:1810
MatchEvaluator & setFindAll(bool x)
Call RegexMatch::setFindAll(bool x).
Definition: jpcre2.hpp:2710
RegexReplace & setRegexObject(Regex const *r)
Set the associated Regex object.
Definition: jpcre2.hpp:3216
RegexReplace(RegexReplace &&rr)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3017
Regex(Regex const &r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3728
uint8_t Ush
8 bit unsigned integer.
Definition: jpcre2.hpp:131
Regex & changeJpcre2Option(Uint opt, bool x)
Add or remove a JPCRE2 option.
Definition: jpcre2.hpp:4082
#define JPCRE2_ASSERT(cond, msg)
char operator[](SIZE_T i) const
operator[] overload to access character by index.
Definition: jpcre2.hpp:664
String const * getPatternPointer() const
Get pointer to pattern string.
Definition: jpcre2.hpp:3894
Provides some default static callback functions.
Definition: jpcre2.hpp:2012
String const * getSubjectPointer() const
Get pointer to subject string.
Definition: jpcre2.hpp:3112
RegexReplace & clear()
Clear all class variables to its default (initial) state (some memory may retain for further use).
Definition: jpcre2.hpp:3051
String replace(String const &mains, String const *repl, Modifier const &mod="", SIZE_T *counter=0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4308
MatchEvaluator & setCallback(typename MatchEvaluatorCallback< NumSub const &, MapNas const &, MapNtN const & >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2518
Regex & setModifierTable(ModifierTable const *mdt)
Set a custom modifier table to be used.
Definition: jpcre2.hpp:4033
virtual RegexMatch & setPcre2Option(Uint x)
Set PCRE2 option match (overwrite existing option)
Definition: jpcre2.hpp:1820
ModifierTable & clearCompileModifierTable()
Clear the compile modifier table to its initial (empty) state.
Definition: jpcre2.hpp:953
MatchEvaluator & resetErrors()
Call RegexMatch::resetErrors().
Definition: jpcre2.hpp:2646
ModifierTable & setReplaceModifierTable(std::string const &tabs, VecOpt const &tabv)
Set modifier table for replace.
Definition: jpcre2.hpp:1073
MatchEvaluator(Regex const *r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2285
class Map< String, String > MapNas
Map for Named substrings.
Definition: jpcre2.hpp:1257
ModifierTable & setReplaceModifierTable(const char *tabsp, const Uint *tabvp)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:1099
ModifierTable & setAllToDefault()
Set all tables to default.
Definition: jpcre2.hpp:1180
static String toString(Char *a)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:1316
MatchEvaluator & clear()
Clears MatchEvaluator.
Definition: jpcre2.hpp:2637
@ FIND_ALL
Find all during match (global match)
Definition: jpcre2.hpp:153
virtual RegexMatch & resetErrors()
reset match related errors to zero.
Definition: jpcre2.hpp:1561
SIZE_T match(String const &s, PCRE2_SIZE start_offset=0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4247
std::vector< SIZE_T > VecOff
vector of size_t.
Definition: jpcre2.hpp:132
SIZE_T preplace(MatchEvaluator me)
Perl compatible replace method with match evaluator.
Definition: jpcre2.hpp:3466
RegexReplace & operator=(RegexReplace &&rr)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3030
virtual MatchData * getMatchDataBlock()
Get the pointer to the match data block that was set previously with setMatchData() Handling memory i...
Definition: jpcre2.hpp:1882
ModifierTable & setCompileModifierTable(const char *tabsp, const Uint *tabvp)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:1139
MatchEvaluator & setCallback(typename MatchEvaluatorCallback< void *, void *, MapNtN const & >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2590
RegexMatch()
Default constructor.
Definition: jpcre2.hpp:1469
virtual SIZE_T match(void)
Perform match operation using info from class variables and return the match count and store the resu...
Definition: jpcre2.hpp:4776
MatchEvaluator & setPcre2Option(Uint x)
Call RegexMatch::setPcre2Option (Uint x).
Definition: jpcre2.hpp:2702
std::string fromMatchOption(Uint po, Uint jo) const
Take match related option value and convert to modifier string.
Definition: jpcre2.hpp:1008
SIZE_T preplace(String *mains, String const *repl, Modifier const &mod="")
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4348
virtual RegexMatch & setStartOffset(PCRE2_SIZE offset)
Set offset from where match starts.
Definition: jpcre2.hpp:1846
Class to take a std::string modifier value with null safety.
Definition: jpcre2.hpp:634
String getSubject() const
Get subject string.
Definition: jpcre2.hpp:3105
String const * getReplaceWithPointer() const
Get pointer to replacement string.
Definition: jpcre2.hpp:3098
virtual RegexMatch & addJpcre2Option(Uint x)
Add option to existing JPCRE2 options for match.
Definition: jpcre2.hpp:1941
std::string getModifier() const
Calculate modifier string from PCRE2 and JPCRE2 options and return it.
Definition: jpcre2.hpp:3911
std::string fromReplaceOption(Uint po, Uint jo) const
Take replace related option value and convert to modifier string.
Definition: jpcre2.hpp:1016
MatchEvaluator(typename MatchEvaluatorCallback< NumSub const &, MapNas const &, void * >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2315
Regex(String const &re, Uint po)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3691
MatchEvaluator & setCallback(typename MatchEvaluatorCallback< void *, MapNas const &, MapNtN const & >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2566
String getPattern() const
Get pattern string.
Definition: jpcre2.hpp:3888
Regex & setJpcre2Option(Uint x)
Set JPCRE2 option for compile (overwrites existing option)
Definition: jpcre2.hpp:4043
virtual String getErrorMessage() const
Returns the last error message.
Definition: jpcre2.hpp:1581
bool operator!() const
Provides boolean check for the status of the object.
Definition: jpcre2.hpp:3824
virtual RegexMatch & setMatchContext(MatchContext *match_context)
Set the match context.
Definition: jpcre2.hpp:1857
std::basic_string< Char_T > String
Typedef for string (std::string, std::wstring, std::u16string, std::u32string).
Definition: jpcre2.hpp:1253
SIZE_T match(void)
Perform match and return the match count.
Definition: jpcre2.hpp:2819
ModifierTable & setCompileModifierTableToDefault()
Set compile modifier table to default.
Definition: jpcre2.hpp:1170
RegexReplace & setSubject(String const &s)
Set the subject string for replace.
Definition: jpcre2.hpp:3227
virtual ~RegexMatch()
Destructor Frees all internal memories that were used.
Definition: jpcre2.hpp:1531
virtual Uint getJpcre2Option() const
Get JPCRE2 option.
Definition: jpcre2.hpp:1643
Regex(String const &re, Uint po, Uint jo)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3708
int getErrorNumber() const
Returns the last error number.
Definition: jpcre2.hpp:3070
ModifierTable & setMatchModifierTableToDefault()
Set match modifie table to default.
Definition: jpcre2.hpp:1150
virtual RegexMatch & setFindAll()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:1837
static String toString(Char const *a)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:1307
MatchEvaluator & setBufferSize(PCRE2_SIZE x)
Set the buffer size that will be used by pcre2_substitute (replace()).
Definition: jpcre2.hpp:2752
Provides public constructors to create Regex object.
Definition: jpcre2.hpp:3550
Uint getJpcre2Option() const
Get JPCRE2 option.
Definition: jpcre2.hpp:3160
MatchEvaluator & changeJpcre2Option(Uint opt, bool x)
Call RegexMatch::changeJpcre2Option(Uint opt, bool x).
Definition: jpcre2.hpp:2776
Pcre2Code const * getPcre2Code() const
Get Pcre2 raw compiled code pointer.
Definition: jpcre2.hpp:3882
String getErrorMessage() const
Returns the last error message.
Definition: jpcre2.hpp:3946
virtual RegexMatch & changePcre2Option(Uint opt, bool x)
Add or remove a PCRE2 option.
Definition: jpcre2.hpp:1921
std::vector< Uint > VecOpt
vector for Uint option values.
Definition: jpcre2.hpp:133
SIZE_T preplace(String const &mains, String const &repl, Modifier const &mod="")
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4364
Regex(Regex &&r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3753
PCRE2_SIZE getBufferSize()
Get the initial buffer size that is being used by internal function pcre2_substitute.
Definition: jpcre2.hpp:2759
RegexReplace & addJpcre2Option(Uint x)
Add specified JPCRE2 option to existing options for replace.
Definition: jpcre2.hpp:3418
static const char NAME[]
Name of the project.
Definition: jpcre2.hpp:120
virtual RegexMatch & setFindAll(bool x)
Set whether to perform global match.
Definition: jpcre2.hpp:1828
void toCompileOption(Modifier const &mod, bool x, Uint *po, Uint *jo, int *en, SIZE_T *eo) const
Modifier parser for compile related options.
Definition: jpcre2.hpp:1000
Regex(String const *re, Uint po, Uint jo)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3717
@ INSUFFICIENT_OVECTOR
Ovector was not big enough during a match.
Definition: jpcre2.hpp:144
MatchEvaluator & setCallback(typename MatchEvaluatorCallback< NumSub const &, MapNas const &, void * >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2469
ModifierTable & resetMatchModifierTable()
Reset the match modifier table to its initial (empty) state including memory.
Definition: jpcre2.hpp:891
Regex & setModifier(Modifier const &x)
set the modifier (resets all JPCRE2 and PCRE2 options) by calling Regex::changeModifier().
Definition: jpcre2.hpp:4024
MatchEvaluator(typename MatchEvaluatorCallback< NumSub const &, MapNas const &, MapNtN const & >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2335
static const char VERSION_PRE_RELEASE[]
Alpha or beta (testing) release version.
Definition: jpcre2.hpp:125
Char_T Char
Typedef for character (char, wchar_t, char16_t, char32_t)
Definition: jpcre2.hpp:1241
virtual PCRE2_SIZE getStartOffset() const
Get offset from where match will start in the subject.
Definition: jpcre2.hpp:1649
RegexReplace & changeJpcre2Option(Uint opt, bool x)
Parse modifier and add/remove equivalent PCRE2 and JPCRE2 options.
Definition: jpcre2.hpp:3385
virtual String const * getSubjectPointer() const
Get pointer to subject string.
Definition: jpcre2.hpp:1600
MatchEvaluator(typename MatchEvaluatorCallback< void *, MapNas const &, void * >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2345
MatchEvaluator(MatchEvaluator &&me)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2403
PCRE2_SIZE getStartOffset() const
Get start offset.
Definition: jpcre2.hpp:3144
MatchEvaluator(typename MatchEvaluatorCallback< NumSub const &, void *, void * >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2305
ModifierTable & clearMatchModifierTable()
Clear the match modifier table to its initial (empty) state.
Definition: jpcre2.hpp:931
SIZE_T length() const
Returns the length of the modifier string.
Definition: jpcre2.hpp:659
RegexReplace & setModifier(Modifier const &s)
Set the modifier string (resets all JPCRE2 and PCRE2 options) by calling RegexReplace::changeModifier...
Definition: jpcre2.hpp:3285
ModifierTable & setCompileModifierTable(std::string const &tabs, const Uint *tabvp)
Set modifier table for compile.
Definition: jpcre2.hpp:1123
MatchEvaluator & setModifier(Modifier const &s)
Call RegexMatch::setModifier(Modifier const& s).
Definition: jpcre2.hpp:2678
MatchEvaluator & setMatchDataBlock(MatchData *mdt)
Call RegexMatch::setMatchDataBlock(MatchContext * mdt);.
Definition: jpcre2.hpp:2741
Modifier()
Default constructor.
Definition: jpcre2.hpp:639
void compile(void)
Compile pattern using info from class variables.
Definition: jpcre2.hpp:4422
Regex(String const &re)
Compile pattern with initialization.
Definition: jpcre2.hpp:3660
ModifierTable const * getModifierTable()
Get the modifier table that is set,.
Definition: jpcre2.hpp:3138
Regex()
Default Constructor.
Definition: jpcre2.hpp:3654
virtual RegexMatch & setNumberedSubstringVector(VecNum *v)
Set a pointer to the numbered substring vector.
Definition: jpcre2.hpp:1710
virtual VecNas const * getNamedSubstringVector() const
Get pointer to named substring vector.
Definition: jpcre2.hpp:1684
RegexReplace & changeModifier(Modifier const &mod, bool x)
After a call to this function PCRE2 and JPCRE2 options will be properly set.
Definition: jpcre2.hpp:3372
std::vector< String > NumSub
Vector for Numbered substrings (Sub container).
Definition: jpcre2.hpp:1271
RegexReplace & addPcre2Option(Uint x)
Add specified PCRE2 option to existing options for replace.
Definition: jpcre2.hpp:3428
struct to select the types.
Definition: jpcre2.hpp:1238
Regex & changeModifier(Modifier const &mod, bool x)
Parse modifier and add/remove equivalent PCRE2 and JPCRE2 options.
Definition: jpcre2.hpp:4070
ModifierTable & setReplaceModifierTableToDefault()
Set replace modifier table to default.
Definition: jpcre2.hpp:1160
MatchEvaluator & setModifierTable(ModifierTable const *mdt)
Call RegexMatch::setModifierTable(ModifierTable const * s).
Definition: jpcre2.hpp:2686
static String erase(void *, void *, void *)
Callback function that removes the matched part/s in the subject string and does not take any match v...
Definition: jpcre2.hpp:2036
char const * c_str() const
Returns the c_str() of modifier string.
Definition: jpcre2.hpp:655
SIZE_T preplace(void)
Perl compatible replace method.
Definition: jpcre2.hpp:3451
std::vector< MapNtN > VecNtN
Vector of substring name to substring number map.
Definition: jpcre2.hpp:1275
Modifier(std::string const &x)
Constructor that takes a std::string.
Definition: jpcre2.hpp:643
uint32_t Uint
Used for options (bitwise operation)
Definition: jpcre2.hpp:130
Regex & resetErrors()
Reset regex compile related errors to zero.
Definition: jpcre2.hpp:3857
virtual VecOff const * getMatchEndOffsetVector() const
Get pre-set match end offset vector pointer.
Definition: jpcre2.hpp:1665
static String getErrorMessage(int err_num, int err_off)
Returns error message (either JPCRE2 or PCRE2) from error number and error offset.
Definition: jpcre2.hpp:1342
RegexReplace & setReplaceWith(String const *s)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3271
RegexReplace & setStartOffset(PCRE2_SIZE start_offset)
Set start offset.
Definition: jpcre2.hpp:3311
RegexReplace & setPcre2Option(Uint x)
Set PCRE2 option replace (overwrite existing option)
Definition: jpcre2.hpp:3333
Uint getPcre2Option() const
Get PCRE2 option.
Definition: jpcre2.hpp:3152
RegexReplace & reset()
Reset all class variables to its default (initial) state including memory.
Definition: jpcre2.hpp:3042
ModifierTable & clearReplaceModifierTable()
Clear the replace modifier table to its initial (empty) state.
Definition: jpcre2.hpp:942
virtual RegexMatch & setSubject(String const *s)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:1774
Provides public constructors to create RegexMatch objects.
Definition: jpcre2.hpp:1375
virtual int getErrorOffset() const
Returns the last error offset.
Definition: jpcre2.hpp:1575
Regex(String const *re)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3667
std::string getModifier() const
Calculate modifier string from PCRE2 and JPCRE2 options and return it.
Definition: jpcre2.hpp:3131
static String toString(Char a)
Converts a Char_T to jpcre2::select::String.
Definition: jpcre2.hpp:1298
void compile(String const *re)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4198
virtual RegexMatch & clear()
Clear all class variables (may retain some memory for further use).
Definition: jpcre2.hpp:1547
std::vector< MapNas > VecNas
Vector of matches with named substrings.
Definition: jpcre2.hpp:1273
virtual VecNtN const * getNameToNumberMapVector() const
Get pointer to name to number map vector.
Definition: jpcre2.hpp:1690
Regex const * getRegexObject() const
Get a pointer to the associated Regex object.
Definition: jpcre2.hpp:3167
virtual RegexMatch & setMatchStartOffsetVector(VecOff *v)
Set the pointer to a vector to store the offsets where matches start in the subject.
Definition: jpcre2.hpp:1742
RegexReplace initReplace()
Returns a default constructed RegexReplace object by value.
Definition: jpcre2.hpp:4264
MatchEvaluator & changeModifier(Modifier const &mod, bool x)
Call RegexMatch::changeModifier(Modifier const& mod, bool x).
Definition: jpcre2.hpp:2767
Regex & setPattern(String const *re)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:4008
virtual RegexMatch & operator=(RegexMatch &&rm)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:1522
RegexReplace & addModifier(Modifier const &mod)
Parse modifier string and add equivalent PCRE2 and JPCRE2 options.
Definition: jpcre2.hpp:3409
virtual RegexMatch & operator=(RegexMatch const &rm)
Overloaded copy-assignment operator.
Definition: jpcre2.hpp:1495
Regex & addJpcre2Option(Uint x)
Add option to existing JPCRE2 options for compile.
Definition: jpcre2.hpp:4114
Modifier(char const *x)
Constructor that takes char const * (null safety is provided by this one)
Definition: jpcre2.hpp:647
Regex(String const *re, Uint po)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:3699
MatchEvaluator(MatchEvaluator const &me)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2379
virtual VecOff const * getMatchStartOffsetVector() const
Get pre-set match start offset vector pointer.
Definition: jpcre2.hpp:1657
This class inherits RegexMatch and provides a similar functionality.
Definition: jpcre2.hpp:2135
int getErrorOffset() const
Returns the last error offset.
Definition: jpcre2.hpp:3940
MatchEvaluator(typename MatchEvaluatorCallback< void *, void *, void * >::Callback mef)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: jpcre2.hpp:2295
MatchEvaluator & addPcre2Option(Uint x)
Call RegexMatch::addPcre2Option(Uint x).
Definition: jpcre2.hpp:2809