Named capture and /g, /G option


#1

Ruby 1.9e$B$K!"e(B
named capturee$B$N7k2L$rL>A0$G;2>H$9$k5!G=$H!"e(B
/g, /G e$B%*%W%7%g%s$rDI2C$7$FNI$$$G$7$g$&$+!)e(B

Hal F.e$B$+$i%a!<%k$,Mh$F!“e(B
e$B$3$l$i$N5!G=$K$D$$$F<ALd$,$”$C$?$N$G$9$,!"e(B
e$B$I$A$i$b<BAu$5$l$F$$$J$$$HEz$($k$N$b<d$7$$$N$Ge(B
e$BF~$l$?$/$J$j$^$7$?!#e(B
e$B$^$@<BAu$O$7$F$$$^$;$s!#e(B


#2

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:28446] named capture and /g, /G option”
on Tue, 21 Mar 2006 10:22:28 +0900, “K.Kosako” removed_email_address@domain.invalid
writes:

|Ruby 1.9e$B$K!"e(B
|named capturee$B$N7k2L$rL>A0$G;2>H$9$k5!G=$H!"e(B
|/g, /G e$B%*%W%7%g%s$rDI2C$7$FNI$$$G$7$g$&$+!)e(B
|
|Hal F.e$B$+$i%a!<%k$,Mh$F!“e(B
|e$B$3$l$i$N5!G=$K$D$$$F<ALd$,$”$C$?$N$G$9$,!"e(B
|e$B$I$A$i$b<BAu$5$l$F$$$J$$$HEz$($k$N$b<d$7$$$N$Ge(B
|e$BF~$l$?$/$J$j$^$7$?!#e(B
|e$B$^$@<BAu$O$7$F$$$^$;$s!#e(B

e$B$O$$!#9=$$$^$;$s!#$?$@!"!Ve(Bnamed capturee$B$N7k2L$rL>A0$G;2>H$9e(B
e$B$k5!G=!W$N;EMM$K$D$$$F$O$I$s$J$b$N$+4JC1$K@bL@$7$F$b$i$($^$;e(B
e$B$s$+!)e(B


#3

Yukihiro M. wrote:

e$B$O$$!#9=$$$^$;$s!#$?$@!"!Ve(Bnamed capturee$B$N7k2L$rL>A0$G;2>H$9e(B
e$B$k5!G=!W$N;EMM$K$D$$$F$O$I$s$J$b$N$+4JC1$K@bL@$7$F$b$i$($^$;e(B
e$B$s$+!)e(B

[ruby-dev:25726]e$B$N;EMM$K$7$F$_$h$&$+$H;W$$$^$9!#e(B

e$B>.Gwe(B

[ruby-dev:25726]


#4

Ruby 1.9e$B$K!"e(B
named capturee$B$N7k2L$rL>A0$G;2>H$9$k5!G=$H!"e(B
/g, /G e$B%*%W%7%g%s$rDI2C$7$FNI$$$G$7$g$&$+!)e(B

/g, /Ge$B$K4X$7$F!“LdBj$,$”$j$^$7$?!#e(B

i,x,me$B%%W%7%g%s$O!"e(BRegexp#to_se$B$G0J2<$N$h$&$KJ];}$5$l$ke(B
e$B$N$G$9$,!“e(Bg, Ge$B$O!”%Q%?!<%sA4BN$K4X$9$k%0%m!<%P%k$Je(B
e$B%
%W%7%g%s$J$N$G!“e(B(?gG:…)e$B$H=q$/5!G=$,$”$j$^$;$s!#e(B

reg = /ab+c/ix
reg.to_s #=> “(?ix-m:ab+c)”

Regexp#to_se$B$G!"e(Bg, Ge$B%*%W%7%g%s>pJs$O<N$F$i$l$k$H$$$&$3$H$Ke(B
e$B$9$k$7$+$J$5$=$&$G$9!#e(B


#5

Tanaka A. wrote:

Ruby 1.9e$B$K!"e(B
named capturee$B$N7k2L$rL>A0$G;2>H$9$k5!G=$H!"e(B
/g, /G e$B%*%W%7%g%s$rDI2C$7$FNI$$$G$7$g$&$+!)e(B
/g, /Ge$B$K4X$7$F!“LdBj$,$”$j$^$7$?!#e(B

Regexp#to_se$B$G!"e(Bg, Ge$B%*%W%7%g%s>pJs$O<N$F$i$l$k$H$$$&$3$H$Ke(B
e$B$9$k$7$+$J$5$=$&$G$9!#e(B

g, G e$B$C$F$I$&$$$&8z2L$J$s$G$7$?$C$1e(B?

g: ONIG_OPTION_DONT_CAPTURE_GROUP
e$BL>A0$J$7=89ge(B(…)e$B$r!"e(Bcapturee$B$J$7$N=89g$H$9$k!#e(B

G: ONIG_OPTION_CAPTURE_GROUP
e$BL>A0$J$7=89ge(B(…)e$B$r!“e(Bcapturee$B$”$j$N=89g$H$9$k!#e(B

e$B$H$$$&0UL#$G$9!#e(B


#6

In article removed_email_address@domain.invalid,
“K.Kosako” removed_email_address@domain.invalid writes:

Ruby 1.9e$B$K!"e(B
named capturee$B$N7k2L$rL>A0$G;2>H$9$k5!G=$H!"e(B
/g, /G e$B%*%W%7%g%s$rDI2C$7$FNI$$$G$7$g$&$+!)e(B

/g, /Ge$B$K4X$7$F!“LdBj$,$”$j$^$7$?!#e(B

Regexp#to_se$B$G!"e(Bg, Ge$B%*%W%7%g%s>pJs$O<N$F$i$l$k$H$$$&$3$H$Ke(B
e$B$9$k$7$+$J$5$=$&$G$9!#e(B

g, G e$B$C$F$I$&$$$&8z2L$J$s$G$7$?$C$1e(B?


#7

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:28449] Re: named capture and /g, /G option”
on Tue, 21 Mar 2006 16:54:57 +0900, “K.Kosako” removed_email_address@domain.invalid
writes:

|Regexp#to_se$B$G!"e(Bg, Ge$B%*%W%7%g%s>pJs$O<N$F$i$l$k$H$$$&$3$H$Ke(B
|e$B$9$k$7$+$J$5$=$&$G$9!#e(B

inspecte$B$G;D$k$J$i!"$^$"!"$$$$$s$8$c$J$$$G$7$g$&$+!#e(B


#8

Yukihiro M. wrote:

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:28449] Re: named capture and /g, /G option”
on Tue, 21 Mar 2006 16:54:57 +0900, “K.Kosako” removed_email_address@domain.invalid writes:

|Regexp#to_se$B$G!"e(Bg, Ge$B%*%W%7%g%s>pJs$O<N$F$i$l$k$H$$$&$3$H$Ke(B
|e$B$9$k$7$+$J$5$=$&$G$9!#e(B

inspecte$B$G;D$k$J$i!"$^$"!"$$$$$s$8$c$J$$$G$7$g$&$+!#e(B

MatchData[String/Symbol]e$B$N$[$&$O%3%_%C%H$7$^$7$?!#e(B

g, Ge$B%*%W%7%g%s$N$[$&$O!":#F|Cf$K<BAu$G$-$J$$$N$G!“e(B
e$B0l=54V8e$0$i$$$K$d$j$^$9!#e(B
e$B$=$N4V$K;EMM$K$D$$$F2?$+0U8+$,$”$kJ}$O$*4j$$$7$^$9!#e(B

e$B2a5n$Ke(Bruby-deve$B$G=P$?7kO@$K4p$E$$$?;EMM$G$9$,!"e(B
e$B54<V$r%@%&%s%m!<%I$7$F%I%-%e%a%s%H$rFI$`J}$O!“e(B
e$B$”$^$j5o$i$l$J$$$H;W$$$^$9$N$G!"0J2<$K0lIt$re(B
e$B%3%T!<$7$F$*$-$^$9!#e(B

e$B>.Gwe(B


  1. e$BJa3M<0=89ge(B

e$BJa3M<0=89ge(B(…)e$B$O!"0J2<$N>r7o$K1~$8$F?6Iq$,JQ2=$9$k!#e(B
(e$BL>A0IU$-Ja3M<0=89g$OJQ2=$7$J$$e(B)

case 1. /…/ (e$BL>A0IU$-Ja3M<0=89g$OIT;HMQ!"%*%W%7%g%s$J$7e(B)

 (...) e$B$O!"Ja3M<0=89g$H$7$F07$o$l$k!#e(B

case 2. /…/g (e$BL>A0IU$-Ja3M<0=89g$OIT;HMQ!"%*%W%7%g%se(B
'g’e$B$r;XDje(B)

 (...) e$B$O!"HsJa3M<0=89g$H$7$F07$o$l$k!#e(B

case 3. /…(?…)…/
(e$BL>A0IU$-Ja3M<0=89g$O;HMQ!"%*%W%7%g%s$J$7e(B)

 (...) e$B$O!"HsJa3M<0=89g$H$7$F07$o$l$k!#e(B
 e$BHV9f;XDj;2>He(B/e$B8F$S=P$7$OIT5v2D!#e(B

case 4. /…(?…)…/G
(e$BL>A0IU$-Ja3M<0=89g$O;HMQ!"%*%W%7%g%se(B ‘G’
e$B$r;XDje(B)

 (...) e$B$O!"Ja3M<0=89g$H$7$F07$o$l$k!#e(B
 e$BHV9f;XDj;2>He(B/e$B8F$S=P$7$O5v2D!#e(B

e$BC"$7e(B
g: ONIG_OPTION_DONT_CAPTURE_GROUP
G: ONIG_OPTION_CAPTURE_GROUP
('g’e$B$He(B’G’e$B%*%W%7%g%s$O!"e(Bruby-dev MLe$B$G5DO@$5$l$?!#e(B)

e$B$3$l$i$N?6Iq$N0UL#$O!“e(B
e$BL>A0IU$-Ja3M$HL>A0L5$7Ja3M$rF1;~$K;HMQ$9$kI,A3@-$N$”$k>lLL$O>/$J$$$G$"$m$&e(B
e$B$H$$$&M}M3$+$i9M$($i$l$?$b$N$G$"$k!#e(B
e$B$3$l$i$N%*%W%7%g%s$K$D$$$F$O!"e(BRubye$B$G$O8=:_<BAu$5$l$F$$$J$$!#e(B


#9

In article removed_email_address@domain.invalid,
“K.Kosako” removed_email_address@domain.invalid writes:

case 3. /…(?…)…/ (e$BL>A0IU$-Ja3M<0=89g$O;HMQ!"%*%W%7%g%s$J$7e(B)

 (...) e$B$O!"HsJa3M<0=89g$H$7$F07$o$l$k!#e(B
 e$BHV9f;XDj;2>He(B/e$B8F$S=P$7$OIT5v2D!#e(B

e$B8=:_$O$3$N>l9g$KHV9f$,;H$($k$h$&$G$9$,!"$3$l$O$3$N;EMM$K$O$^e(B
e$B$@$J$C$F$$$J$$$H$$$&$3$H$G$9$+e(B?

% ./ruby -ve ‘/(?.*)e/ =~ “abcdef”; p $~[1], $~[:n]’
ruby 1.9.0 (2006-03-21) [i686-linux]
“abcd”
“abcd”


#10

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

e$BH?BP$G$bMWK>$G$b$J$/=c?h$K<ALd$J$N$G$9$,!"e(B

In message “Re: [ruby-dev:28453] Re: named capture and /g, /G option”
on Tue, 21 Mar 2006 22:58:01 +0900, “K.Kosako” removed_email_address@domain.invalid
writes:

| case 3. /…(?…)…/ (e$BL>A0IU$-Ja3M<0=89g$O;HMQ!"%*%W%7%g%s$J$7e(B)
|
| (…) e$B$O!"HsJa3M<0=89g$H$7$F07$o$l$k!#e(B
| e$BHV9f;XDj;2>He(B/e$B8F$S=P$7$OIT5v2D!#e(B

e$B$3$N!VIT5v2D!W$H$$$&$N$Oe(B\1e$B$J$I$,J8K!%(%i!<$K$J$k$H$$$&0UL#$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2>H$r<B9T;~%(%i!<$K$9$k$+!)e(B
  2. MatchData#[]e$B$N0z?t$NHV9fe(B(n >= 1)e$B;2>H$re(B
    e$B<B9T;~%(%i!<$K$9$k$+!)e(B
  3. $1, … $9e$B$r<B9T;~%(%i!<$K$9$k$+!)e(B
    e$B$=$l$H!"e(B
  4. e$BCV49J8;zNs$NCf$NL>A0;XDj$N7A<0e(B

e$B;d$N0U8+$H$7$F$O!"e(B1,2,3e$BA4It5v2D$K$9$k$+!“e(B
3e$B$N$_5v2D$N$I$A$i$+$+$J$H;W$$$^$9!#e(B
4.e$B$K$D$$$F$O!”%Q%?!<%sCf$NL>A0;2>H$HF1$87A<0e(B
\ke$B$GNI$$$+$J$H;W$$$^$9!#e(B

4e$B$@$1$O:#F|<BAu$7$h$&$H;W$$$^$9$,!"8e$Ge(B
e$BJQ99$7$F$b$i$C$F$b9=$$$^$;$s!#e(B


#12

In article removed_email_address@domain.invalid,
“K.Kosako” removed_email_address@domain.invalid writes:

Rubye$B%l%Y%k$G$N;EMMJQ99e(B/e$B3HD%$K$D$$$F$O!":rF|$N:n6He(B
e$B$NCf$G$OA4$/K:$l$F$$$^$7$?!#e(B

e$B$b$&K:$l$F$7$^$C$F$$$k$N$G$9$,!"$3$N$"$?$j$N;EMMe(B
e$B$K$D$$$F!"0JA0$N5DO@$G7kO@$,=P$F$$$?$G$7$g$&$+!)e(B

e$B$&!"$A$g$C$H4*0c$$$7$F$^$7$?!#L>A0$,$D$$$F$$$k>l9g$bHV9f$,$De(B
e$B$/!"$H$$$&OC$J$o$1$G$9$M!#e(B

e$B$&$%$`!#$3$l$O$I$&$7$?$b$s$+$J!#e(B

e$BL>A0$rHV9f$Ne(B alias e$B$@$H;W$($PHV9f$bIU$1$F$*$/$3$H$K0cOB46$Oe(B
e$B$J$$$G$9$,!"5U$KL>A0$@$1$G%W%m%0%i%`$r=q$/$3$H$r?d>)$7$?$$$He(B
e$B;W$($P:G=i$+$iHV9f$r$D$1$J$$$h$&$K$7$?$$$H$$$&5$$b$7$^$9!#e(B

e$B$=$l$O$=$l$H$7$F%(%i!<$H$$$&A*Br;h$O$J$5$=$&$J5$$,$7$^$9!#e(B
e$B8=:$G$b$"$kHV9f$KBP1~$9$ke(B capture e$B$,B8:$7$J$$>l9g$O$"$k$oe(B
e$B$1$G$9$,!"%(%i!<$K$O$J$i$J$$$o$1$G$9$7!#e(B
/(a)/ =~ “a”; p $2 e$B$H$+!#e(B

e$B$"$H$O!“7k6Ie(B 0e$BHV$O$$$D$b$”$k$H$+!"e(BMatchData
e$B$O8=;~E@$G$+$J$je(B
Array e$B$C$]$$$s$G!"HV9f$r$D$1$J$$$N$OOD$K$J$j$d$9$$5$$O$7$^$9!#e(B

e$B$=$l$O$=$l$H$7$FL>A0$N%j%9%H$rJV$9e(B MatchData#keys e$B$OI,MW$@$He(B
e$B;W$$$^$9!#$^$!!"$3$Ne(B keys e$B$K$bHV9f$r4^$a$k$Y$-$+H]$+$H$$$&Lde(B
e$BBj$O$"$k$o$1$G$9$,!#e(B


#13

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:28457] Re: named capture and /g, /G option”
on Wed, 22 Mar 2006 21:03:54 +0900, “K.Kosako” removed_email_address@domain.invalid
writes:

|e$B$b$&K:$l$F$7$^$C$F$$$k$N$G$9$,!"$3$N$"$?$j$N;EMMe(B
|e$B$K$D$$$F!"0JA0$N5DO@$G7kO@$,=P$F$$$?$G$7$g$&$+!)e(B

e$B7kO@$O=P$F$J$$$H;W$$$^$9$1$I!"$^$"!"$($$$d!"$G7h$a$F$$$$$s$8$ce(B
e$B$J$$$G$7$g$&$+!#e(B

|e$BLdBjE@$r@0M}$9$k$H!"e(B
|
|e$B%Q%?!<%s$H%*%W%7%g%s$NAH$_9g$o$;$GHV9f;2>H$,e(B
|e$BL58z$K$J$C$F$$$k$H$-!"e(BRubye$B%l%Y%k$G!"e(B
| 1. e$BCV49J8;zNs$NCf$NHV9f;2>H$r<B9T;~%(%i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$J$/$9$ke(B
e$B$3$H$K$7$F!"MM;R$r8+$^$7$g$&$+!#e(B

e$BHV9f;2>H$G$-$J$/$9$k$H$$$&$N$O!“EDCf$5$s$N%a!<%k$Ke(B
e$B=>$&$H!”%(%i!<$K$9$k$N$G$O$J$/CM$re(Bnile$B$H$9$k$3$H$Ke(B
e$B$J$k$H;W$$$^$9$,!"$=$l$GNI$$$G$7$g$&$+!)e(B


#15

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:28459] Re: named capture and /g, /G option”
on Wed, 22 Mar 2006 23:43:17 +0900, Tanaka A. removed_email_address@domain.invalid
writes:

|e$BL>A0$rHV9f$Ne(B alias e$B$@$H;W$($PHV9f$bIU$1$F$*$/$3$H$K0cOB46$Oe(B
|e$B$J$$$G$9$,!"5U$KL>A0$@$1$G%W%m%0%i%`$r=q$/$3$H$r?d>)$7$?$$$He(B
|e$B;W$($P:G=i$+$iHV9f$r$D$1$J$$$h$&$K$7$?$$$H$$$&5$$b$7$^$9!#e(B

e$B$&!<$!"CV49$J$I$K4X$7$F$OHV9f$O%^%C%A$7$J$$$3$H$K!"e(B MatchDatae$B$K$D$$$F$Oe(BStructe$B$NN?d$+$iHV9f$b5v$9$H$$$&$N$G$I$&e(B
e$B$G$7$g$&$+!#e(B


#16

Yukihiro M. wrote:

e$B$O$$!#e(B

e$B$?$@!"CV49J8;zNsCf$G$O!VCM$re(Bnile$B!W$H$$$&$N$O0UL#$,$J$$$N$G!"e(B
e$B!V%^%C%A$7$F$$$J$$$N$HF1MM$K6uJ8;z$KCV49!W$H$J$k$H;W$$$^$9!#e(B

e$B@hDx!"%3%_%C%H$7$^$7$?!#e(B


#17

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:28461] Re: named capture and /g, /G option”
on Thu, 23 Mar 2006 00:48:25 +0900, “K.Kosako” removed_email_address@domain.invalid
writes:

|> e$B$&!<$!"CV49$J$I$K4X$7$F$OHV9f$O%^%C%A$7$J$$$3$H$K!"e(B |> MatchDatae$B$K$D$$$F$Oe(BStructe$B$NN?d$+$iHV9f$b5v$9$H$$$&$N$G$I$&e(B
|> e$B$G$7$g$&$+!#e(B
|
|e$B$=$l$G$O!"CV49J8;zNs$NCf$@$1HV9f;2>H$G$-$J$/$9$ke(B
|e$B$3$H$K$7$F!"MM;R$r8+$^$7$g$&$+!#e(B

e$B$*4j$$$7$^$9!#@55,I=8=Cf$Ne(B \1
e$B$J$I$O85$+$i;H$($J$$e(B(e$B%^%C%A$7e(B
e$B$J$$e(B)e$B$s$G$9$h$M!#e(B

|e$BHV9f;2>H$G$-$J$/$9$k$H$$$&$N$O!“EDCf$5$s$N%a!<%k$Ke(B
|e$B=>$&$H!”%(%i!<$K$9$k$N$G$O$J$/CM$re(Bnile$B$H$9$k$3$H$Ke(B
|e$B$J$k$H;W$$$^$9$,!"$=$l$GNI$$$G$7$g$&$+!)e(B

e$B$O$$!#e(B

e$B$?$@!"CV49J8;zNsCf$G$O!VCM$re(Bnile$B!W$H$$$&$N$O0UL#$,$J$$$N$G!"e(B
e$B!V%^%C%A$7$F$$$J$$$N$HF1MM$K6uJ8;z$KCV49!W$H$J$k$H;W$$$^$9!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

#18

In article removed_email_address@domain.invalid,
Yukihiro M. removed_email_address@domain.invalid writes:

e$B$&!<$!"CV49$J$I$K4X$7$F$OHV9f$O%^%C%A$7$J$$$3$H$K!"e(B MatchDatae$B$K$D$$$F$Oe(BStructe$B$NN?d$+$iHV9f$b5v$9$H$$$&$N$G$I$&e(B
e$B$G$7$g$&$+!#e(B

% ruby -e ‘S = Struct.new(“S”, :a, :b)
p S.new(1, 2)[3]’
-e:2:in `Struct#[]’: offset 3 too large for struct(size:2) (IndexError)
from -e:2

e$B$&$%$`!#e(BStruct e$B$NHO0O30$ONc30$G$9$M$’!#e(B

e$B$H$9$k$HNc30$H$$$&$N$b$"$j$&$k$+$J$!!#e(B


#19

Tanaka A. wrote:

e$B$H$9$k$HNc30$H$$$&$N$b$"$j$&$k$+$J$!!#e(B

e$BHV9f;XDj$r6X;_$9$k$H$$$&$3$H$G$O$J$/$F!"e(B
e$BHO0O30$NCM$N$H$-$@$1Nc30$K$9$k$H$$$&$3$H$G$9$+!)e(B

e$B$I$A$i$+$H$$$&$H!"$=$&$7$?$[$&$,NI$$$H;W$$$^$9$,!“e(B
e$B0z?t$GHO0O;XDj$b$G$-$k$N$G!”$=$N>l9g$I$&$9$k$+e(B
e$B$H$$$&$3$H$,$"$j$^$9!#e(B


#20

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:28472] Re: named capture and /g, /G option”
on Tue, 28 Mar 2006 10:05:29 +0900, Tanaka A. removed_email_address@domain.invalid
writes:

|% ruby -e ‘S = Struct.new(“S”, :a, :b)
|p S.new(1, 2)[3]’
|-e:2:in Struct#[]': offset 3 too large for struct(size:2) (IndexError) | from -e:2 | |e$B$&$%$!#e(BStruct e$B$NHO0O30$ONc30$G$9$M$’!#e(B
|
|e$B$H$9$k$HNc30$H$$$&$N$b$"$j$&$k$+$J$!!#e(B

e$B$"$j$($^$9$1$I!"2~$a$F$=$&$9$kI,MW$O$J$$$h$&$K;W$$$^$9!#e(B