Class: RE2::Regexp
- Inherits:
-
Object
- Object
- RE2::Regexp
- Defined in:
- ext/re2/re2.cc
Class Method Summary collapse
- .compile ⇒ Object
-
.escape(unquoted) ⇒ String
Returns a version of str with all potentially meaningful regexp characters escaped.
-
.quote(unquoted) ⇒ String
Returns a version of str with all potentially meaningful regexp characters escaped.
Instance Method Summary collapse
-
#===(text) ⇒ Boolean
Returns true or false to indicate a successful match.
-
#=~(text) ⇒ Boolean
Returns true or false to indicate a successful match.
-
#case_insensitive? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled with the case_sensitive option set to false. -
#case_sensitive? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled with the case_sensitive option set to true. -
#casefold? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled with the case_sensitive option set to false. -
#error ⇒ String?
If the RE2 could not be created properly, returns an error string otherwise returns nil.
-
#error_arg ⇒ String?
If the RE2 could not be created properly, returns the offending portion of the regexp otherwise returns nil.
-
#initialize(*args) ⇒ RE2::Regexp
constructor
Returns a new Regexp object with a compiled version of
patternstored inside. -
#inspect ⇒ String
Returns a printable version of the regular expression
re2. -
#literal? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled with the literal option set to true. -
#log_errors? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled with the log_errors option set to true. -
#longest_match? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled with the longest_match option set to true. -
#match(*args) ⇒ Boolean, RE2::MatchData
Match the pattern against the given
textand return either a boolean (if no submatches are required) or a MatchData instance. -
#match?(text) ⇒ Boolean
Returns true or false to indicate a successful match.
-
#max_mem ⇒ Fixnum
Returns the max_mem setting for the regular expression
re2. -
#named_capturing_groups ⇒ Hash
Returns a hash of names to capturing indices of groups.
-
#never_nl? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled with the never_nl option set to true. -
#number_of_capturing_groups ⇒ Fixnum
Returns the number of capturing subpatterns, or -1 if the regexp wasn’t valid on construction.
-
#ok? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled successfully or not. -
#one_line? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled with the one_line option set to true. -
#options ⇒ Hash
Returns a hash of the options currently set for
re2. -
#pattern ⇒ String
Returns a string version of the regular expression
re2. -
#perl_classes? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled with the perl_classes option set to true. -
#posix_syntax? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled with the posix_syntax option set to true. -
#program_size ⇒ Fixnum
Returns the program size, a very approximate measure of a regexp’s “cost”.
-
#scan(text) ⇒ Object
Returns a Scanner for scanning the given text incrementally.
-
#source ⇒ String
Returns a string version of the regular expression
re2. -
#to_s ⇒ String
Returns a string version of the regular expression
re2. -
#to_str ⇒ String
Returns a string version of the regular expression
re2. -
#utf8? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled with the utf8 option set to true. -
#word_boundary? ⇒ Boolean
Returns whether or not the regular expression
re2was compiled with the word_boundary option set to true.
Constructor Details
#initialize(pattern) ⇒ RE2::Regexp #initialize(pattern, options) ⇒ RE2::Regexp
Returns a new RE2::Regexp object with a compiled version of pattern stored inside.
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 |
# File 'ext/re2/re2.cc', line 669 static VALUE re2_regexp_initialize(int argc, VALUE *argv, VALUE self) { VALUE pattern, , utf8, posix_syntax, longest_match, log_errors, max_mem, literal, never_nl, case_sensitive, perl_classes, word_boundary, one_line; re2_pattern *p; rb_scan_args(argc, argv, "11", &pattern, &); Data_Get_Struct(self, re2_pattern, p); if (RTEST()) { if (TYPE() != T_HASH) { rb_raise(rb_eArgError, "options should be a hash"); } RE2::Options ; utf8 = rb_hash_aref(, ID2SYM(id_utf8)); if (!NIL_P(utf8)) { .set_encoding(RTEST(utf8) ? RE2::Options::EncodingUTF8 : RE2::Options::EncodingLatin1); } posix_syntax = rb_hash_aref(, ID2SYM(id_posix_syntax)); if (!NIL_P(posix_syntax)) { .set_posix_syntax(RTEST(posix_syntax)); } longest_match = rb_hash_aref(, ID2SYM(id_longest_match)); if (!NIL_P(longest_match)) { .set_longest_match(RTEST(longest_match)); } log_errors = rb_hash_aref(, ID2SYM(id_log_errors)); if (!NIL_P(log_errors)) { .set_log_errors(RTEST(log_errors)); } max_mem = rb_hash_aref(, ID2SYM(id_max_mem)); if (!NIL_P(max_mem)) { .set_max_mem(NUM2INT(max_mem)); } literal = rb_hash_aref(, ID2SYM(id_literal)); if (!NIL_P(literal)) { .set_literal(RTEST(literal)); } never_nl = rb_hash_aref(, ID2SYM(id_never_nl)); if (!NIL_P(never_nl)) { .set_never_nl(RTEST(never_nl)); } case_sensitive = rb_hash_aref(, ID2SYM(id_case_sensitive)); if (!NIL_P(case_sensitive)) { .set_case_sensitive(RTEST(case_sensitive)); } perl_classes = rb_hash_aref(, ID2SYM(id_perl_classes)); if (!NIL_P(perl_classes)) { .set_perl_classes(RTEST(perl_classes)); } word_boundary = rb_hash_aref(, ID2SYM(id_word_boundary)); if (!NIL_P(word_boundary)) { .set_word_boundary(RTEST(word_boundary)); } one_line = rb_hash_aref(, ID2SYM(id_one_line)); if (!NIL_P(one_line)) { .set_one_line(RTEST(one_line)); } p->pattern = new(nothrow) RE2(StringValuePtr(pattern), ); } else { p->pattern = new(nothrow) RE2(StringValuePtr(pattern)); } if (p->pattern == 0) { rb_raise(rb_eNoMemError, "not enough memory to allocate RE2 object"); } return self; } |
Class Method Details
.compile ⇒ Object
.escape(unquoted) ⇒ String
Returns a version of str with all potentially meaningful regexp characters escaped. The returned string, used as a regular expression, will exactly match the original string.
1344 1345 1346 1347 1348 |
# File 'ext/re2/re2.cc', line 1344 static VALUE re2_QuoteMeta(VALUE self, VALUE unquoted) { UNUSED(self); string quoted_string = RE2::QuoteMeta(StringValuePtr(unquoted)); return rb_str_new(quoted_string.data(), quoted_string.size()); } |
.quote(unquoted) ⇒ String
Returns a version of str with all potentially meaningful regexp characters escaped. The returned string, used as a regular expression, will exactly match the original string.
1344 1345 1346 1347 1348 |
# File 'ext/re2/re2.cc', line 1344 static VALUE re2_QuoteMeta(VALUE self, VALUE unquoted) { UNUSED(self); string quoted_string = RE2::QuoteMeta(StringValuePtr(unquoted)); return rb_str_new(quoted_string.data(), quoted_string.size()); } |
Instance Method Details
#===(text) ⇒ Boolean
Returns true or false to indicate a successful match. Equivalent to re2.match(text, 0).
1228 1229 1230 1231 1232 1233 1234 |
# File 'ext/re2/re2.cc', line 1228 static VALUE re2_regexp_match_query(VALUE self, VALUE text) { VALUE argv[2]; argv[0] = text; argv[1] = INT2FIX(0); return re2_regexp_match(2, argv, self); } |
#=~(text) ⇒ Boolean
Returns true or false to indicate a successful match. Equivalent to re2.match(text, 0).
1228 1229 1230 1231 1232 1233 1234 |
# File 'ext/re2/re2.cc', line 1228 static VALUE re2_regexp_match_query(VALUE self, VALUE text) { VALUE argv[2]; argv[0] = text; argv[1] = INT2FIX(0); return re2_regexp_match(2, argv, self); } |
#case_insensitive? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled with the case_sensitive option set to false.
936 937 938 |
# File 'ext/re2/re2.cc', line 936 static VALUE re2_regexp_case_insensitive(VALUE self) { return BOOL2RUBY(re2_regexp_case_sensitive(self) != Qtrue); } |
#case_sensitive? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled with the case_sensitive option set to true.
920 921 922 923 924 |
# File 'ext/re2/re2.cc', line 920 static VALUE re2_regexp_case_sensitive(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return BOOL2RUBY(p->pattern->().case_sensitive()); } |
#casefold? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled with the case_sensitive option set to false.
936 937 938 |
# File 'ext/re2/re2.cc', line 936 static VALUE re2_regexp_case_insensitive(VALUE self) { return BOOL2RUBY(re2_regexp_case_sensitive(self) != Qtrue); } |
#error ⇒ String?
If the RE2 could not be created properly, returns an error string otherwise returns nil.
991 992 993 994 995 996 997 998 999 |
# File 'ext/re2/re2.cc', line 991 static VALUE re2_regexp_error(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); if (p->pattern->ok()) { return Qnil; } else { return rb_str_new(p->pattern->error().data(), p->pattern->error().size()); } } |
#error_arg ⇒ String?
If the RE2 could not be created properly, returns the offending portion of the regexp otherwise returns nil.
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 |
# File 'ext/re2/re2.cc', line 1007 static VALUE re2_regexp_error_arg(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); if (p->pattern->ok()) { return Qnil; } else { return ENCODED_STR_NEW(p->pattern->error_arg().data(), p->pattern->error_arg().size(), p->pattern->().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1"); } } |
#inspect ⇒ String
Returns a printable version of the regular expression re2.
760 761 762 763 764 765 766 767 768 769 770 771 772 773 |
# File 'ext/re2/re2.cc', line 760 static VALUE re2_regexp_inspect(VALUE self) { re2_pattern *p; VALUE result; ostringstream output; Data_Get_Struct(self, re2_pattern, p); output << "#<RE2::Regexp /" << p->pattern->pattern() << "/>"; result = ENCODED_STR_NEW(output.str().data(), output.str().length(), p->pattern->().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1"); return result; } |
#literal? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled with the literal option set to true.
890 891 892 893 894 |
# File 'ext/re2/re2.cc', line 890 static VALUE re2_regexp_literal(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return BOOL2RUBY(p->pattern->().literal()); } |
#log_errors? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled with the log_errors option set to true.
860 861 862 863 864 |
# File 'ext/re2/re2.cc', line 860 static VALUE re2_regexp_log_errors(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return BOOL2RUBY(p->pattern->().log_errors()); } |
#longest_match? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled with the longest_match option set to true.
845 846 847 848 849 |
# File 'ext/re2/re2.cc', line 845 static VALUE re2_regexp_longest_match(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return BOOL2RUBY(p->pattern->().longest_match()); } |
#match(text) ⇒ RE2::MatchData #match(text, 0) ⇒ Boolean #match(text, number_of_matches) ⇒ RE2::MatchData
Match the pattern against the given text and return either a boolean (if no submatches are required) or a MatchData instance.
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 |
# File 'ext/re2/re2.cc', line 1167 static VALUE re2_regexp_match(int argc, VALUE *argv, VALUE self) { int n; bool matched; re2_pattern *p; re2_matchdata *m; VALUE text, number_of_matches, matchdata; rb_scan_args(argc, argv, "11", &text, &number_of_matches); /* Ensure text is a string. */ text = StringValue(text); Data_Get_Struct(self, re2_pattern, p); if (RTEST(number_of_matches)) { n = NUM2INT(number_of_matches); } else { n = p->pattern->NumberOfCapturingGroups(); } if (n == 0) { matched = match(p->pattern, StringValuePtr(text), 0, static_cast<int>(RSTRING_LEN(text)), RE2::UNANCHORED, 0, 0); return BOOL2RUBY(matched); } else { /* Because match returns the whole match as well. */ n += 1; matchdata = rb_class_new_instance(0, 0, re2_cMatchData); Data_Get_Struct(matchdata, re2_matchdata, m); m->matches = new(nothrow) re2::StringPiece[n]; m->regexp = self; m->text = rb_str_dup(text); rb_str_freeze(m->text); if (m->matches == 0) { rb_raise(rb_eNoMemError, "not enough memory to allocate StringPieces for matches"); } m->number_of_matches = n; matched = match(p->pattern, StringValuePtr(m->text), 0, static_cast<int>(RSTRING_LEN(m->text)), RE2::UNANCHORED, m->matches, n); if (matched) { return matchdata; } else { return Qnil; } } } |
#match?(text) ⇒ Boolean
Returns true or false to indicate a successful match. Equivalent to re2.match(text, 0).
1228 1229 1230 1231 1232 1233 1234 |
# File 'ext/re2/re2.cc', line 1228 static VALUE re2_regexp_match_query(VALUE self, VALUE text) { VALUE argv[2]; argv[0] = text; argv[1] = INT2FIX(0); return re2_regexp_match(2, argv, self); } |
#max_mem ⇒ Fixnum
Returns the max_mem setting for the regular expression re2.
875 876 877 878 879 |
# File 'ext/re2/re2.cc', line 875 static VALUE re2_regexp_max_mem(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return INT2FIX(p->pattern->().max_mem()); } |
#named_capturing_groups ⇒ Hash
Returns a hash of names to capturing indices of groups.
1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 |
# File 'ext/re2/re2.cc', line 1103 static VALUE re2_regexp_named_capturing_groups(VALUE self) { VALUE capturing_groups; re2_pattern *p; map<string, int> groups; map<string, int>::iterator iterator; Data_Get_Struct(self, re2_pattern, p); groups = p->pattern->NamedCapturingGroups(); capturing_groups = rb_hash_new(); for (iterator = groups.begin(); iterator != groups.end(); iterator++) { rb_hash_aset(capturing_groups, ENCODED_STR_NEW(iterator->first.data(), iterator->first.size(), p->pattern->().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1"), INT2FIX(iterator->second)); } return capturing_groups; } |
#never_nl? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled with the never_nl option set to true.
905 906 907 908 909 |
# File 'ext/re2/re2.cc', line 905 static VALUE re2_regexp_never_nl(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return BOOL2RUBY(p->pattern->().never_nl()); } |
#number_of_capturing_groups ⇒ Fixnum
Returns the number of capturing subpatterns, or -1 if the regexp wasn’t valid on construction. The overall match ($0) does not count: if the regexp is “(a)(b)”, returns 2.
1091 1092 1093 1094 1095 1096 |
# File 'ext/re2/re2.cc', line 1091 static VALUE re2_regexp_number_of_capturing_groups(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return INT2FIX(p->pattern->NumberOfCapturingGroups()); } |
#ok? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled successfully or not.
800 801 802 803 804 |
# File 'ext/re2/re2.cc', line 800 static VALUE re2_regexp_ok(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return BOOL2RUBY(p->pattern->ok()); } |
#one_line? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled with the one_line option set to true.
979 980 981 982 983 |
# File 'ext/re2/re2.cc', line 979 static VALUE re2_regexp_one_line(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return BOOL2RUBY(p->pattern->().one_line()); } |
#options ⇒ Hash
Returns a hash of the options currently set for re2.
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 |
# File 'ext/re2/re2.cc', line 1038 static VALUE (VALUE self) { VALUE ; re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); = rb_hash_new(); rb_hash_aset(, ID2SYM(id_utf8), BOOL2RUBY(p->pattern->().encoding() == RE2::Options::EncodingUTF8)); rb_hash_aset(, ID2SYM(id_posix_syntax), BOOL2RUBY(p->pattern->().posix_syntax())); rb_hash_aset(, ID2SYM(id_longest_match), BOOL2RUBY(p->pattern->().longest_match())); rb_hash_aset(, ID2SYM(id_log_errors), BOOL2RUBY(p->pattern->().log_errors())); rb_hash_aset(, ID2SYM(id_max_mem), INT2FIX(p->pattern->().max_mem())); rb_hash_aset(, ID2SYM(id_literal), BOOL2RUBY(p->pattern->().literal())); rb_hash_aset(, ID2SYM(id_never_nl), BOOL2RUBY(p->pattern->().never_nl())); rb_hash_aset(, ID2SYM(id_case_sensitive), BOOL2RUBY(p->pattern->().case_sensitive())); rb_hash_aset(, ID2SYM(id_perl_classes), BOOL2RUBY(p->pattern->().perl_classes())); rb_hash_aset(, ID2SYM(id_word_boundary), BOOL2RUBY(p->pattern->().word_boundary())); rb_hash_aset(, ID2SYM(id_one_line), BOOL2RUBY(p->pattern->().one_line())); /* This is a read-only hash after all... */ rb_obj_freeze(); return ; } |
#pattern ⇒ String
Returns a string version of the regular expression re2.
783 784 785 786 787 788 789 |
# File 'ext/re2/re2.cc', line 783 static VALUE re2_regexp_to_s(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return ENCODED_STR_NEW(p->pattern->pattern().data(), p->pattern->pattern().size(), p->pattern->().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1"); } |
#perl_classes? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled with the perl_classes option set to true.
949 950 951 952 953 |
# File 'ext/re2/re2.cc', line 949 static VALUE re2_regexp_perl_classes(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return BOOL2RUBY(p->pattern->().perl_classes()); } |
#posix_syntax? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled with the posix_syntax option set to true.
830 831 832 833 834 |
# File 'ext/re2/re2.cc', line 830 static VALUE re2_regexp_posix_syntax(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return BOOL2RUBY(p->pattern->().posix_syntax()); } |
#program_size ⇒ Fixnum
Returns the program size, a very approximate measure of a regexp’s “cost”. Larger numbers are more expensive than smaller numbers.
1026 1027 1028 1029 1030 |
# File 'ext/re2/re2.cc', line 1026 static VALUE re2_regexp_program_size(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return INT2FIX(p->pattern->ProgramSize()); } |
#scan(text) ⇒ Object
Returns a Scanner for scanning the given text incrementally.
1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 |
# File 'ext/re2/re2.cc', line 1242 static VALUE re2_regexp_scan(VALUE self, VALUE text) { re2_pattern *p; re2_scanner *c; VALUE scanner; Data_Get_Struct(self, re2_pattern, p); scanner = rb_class_new_instance(0, 0, re2_cScanner); Data_Get_Struct(scanner, re2_scanner, c); c->input = new(nothrow) re2::StringPiece(StringValuePtr(text)); c->regexp = self; c->text = text; c->number_of_capturing_groups = p->pattern->NumberOfCapturingGroups(); c->eof = false; return scanner; } |
#source ⇒ String
Returns a string version of the regular expression re2.
783 784 785 786 787 788 789 |
# File 'ext/re2/re2.cc', line 783 static VALUE re2_regexp_to_s(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return ENCODED_STR_NEW(p->pattern->pattern().data(), p->pattern->pattern().size(), p->pattern->().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1"); } |
#to_s ⇒ String
Returns a string version of the regular expression re2.
783 784 785 786 787 788 789 |
# File 'ext/re2/re2.cc', line 783 static VALUE re2_regexp_to_s(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return ENCODED_STR_NEW(p->pattern->pattern().data(), p->pattern->pattern().size(), p->pattern->().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1"); } |
#to_str ⇒ String
Returns a string version of the regular expression re2.
783 784 785 786 787 788 789 |
# File 'ext/re2/re2.cc', line 783 static VALUE re2_regexp_to_s(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return ENCODED_STR_NEW(p->pattern->pattern().data(), p->pattern->pattern().size(), p->pattern->().encoding() == RE2::Options::EncodingUTF8 ? "UTF-8" : "ISO-8859-1"); } |
#utf8? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled with the utf8 option set to true.
815 816 817 818 819 |
# File 'ext/re2/re2.cc', line 815 static VALUE re2_regexp_utf8(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return BOOL2RUBY(p->pattern->().encoding() == RE2::Options::EncodingUTF8); } |
#word_boundary? ⇒ Boolean
Returns whether or not the regular expression re2 was compiled with the word_boundary option set to true.
964 965 966 967 968 |
# File 'ext/re2/re2.cc', line 964 static VALUE re2_regexp_word_boundary(VALUE self) { re2_pattern *p; Data_Get_Struct(self, re2_pattern, p); return BOOL2RUBY(p->pattern->().word_boundary()); } |