Regexp match confused by thread

e$B0J2<$N%W%m%0%i%`$G!"e(B$~.size e$B$O!"e(B/((ab)(ab))*b/
e$B$K$O3g8L$,e(B
3e$B$DF~$C$F$$$k$?$a!"e(B4 e$B$rI=<($9$k$O$:$J$N$G$9$,!"e(B1
e$B$,I=<($5$le(B
e$B$^$9!#e(B

% ./ruby -ve ’
Thread.new { loop { // =~ “abc” } }
sleep 1
5.times {
/((ab)(ab))*b/ =~ “ab”*8
p $~.size
}

ruby 1.9.0 (2008-04-23 revision 16172) [i686-linux]
1
1
1
1
1

e$B0J2<$N$h$&$K!":G=i$K5/F0$9$k%9%l%C%I$r=|5n$9$k$H!"0U?^$I$*$je(B
e$B$Ke(B 4 e$B$,I=<($5$l$k$h$&$K$J$j$^$9!#e(B

% ./ruby -ve ’
#Thread.new { loop { // =~ “abc” } }
sleep 1
5.times {
/((ab)(ab))*b/ =~ “ab”*8
p $~.size
}

ruby 1.9.0 (2008-04-23 revision 16172) [i686-linux]
4
4
4
4
4

e$B%o%J%Y$H?=$7$^$9!#e(B

08/04/23 e$B$Ke(B Tanaka A.[email protected] e$B$5$s$O=q$-$^$7$?e(B:

e$B0J2<$N%W%m%0%i%`$G!"e(B$~.size e$B$O!"e(B/((ab)(ab))*b/ e$B$K$O3g8L$,e(B
3e$B$DF~$C$F$$$k$?$a!"e(B4 e$B$rI=<($9$k$O$:$J$N$G$9$,!"e(B1 e$B$,I=<($5$le(B
e$B$^$9!#e(B

e$B$3$s$J46$8$G$I$&$G$7$g$&$+!#e(B

Index: re.c

— re.c (revision 16218)
+++ re.c (working copy)
@@ -1255,7 +1255,7 @@
{
int result;
VALUE match;

  • static struct re_registers regs;
  • struct re_registers regs;
    char *range = RSTRING_PTR(str);
    regex_t *reg0 = RREGEXP(re)->ptr, *reg;
    int busy = FL_TEST(re, REG_BUSY);
    @@ -1271,6 +1271,7 @@
    if (!reverse) {
    range += RSTRING_LEN(str);
    }
  • MEMZERO(&regs, struct re_registers, 1);
    result = onig_search(reg,
    (UChar*)(RSTRING_PTR(str)),
    ((UChar*)(RSTRING_PTR(str)) +
    RSTRING_LEN(str)),

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs