str ..    Ă
re.scan("\\w+", str)::group(0) .. ["", "", "", "Ă"]
re.scan("\\w+", str, 10)::group(0) .. ["", "", "Ă"]
re.scan("\\w+", str, 0, 10)::group(0) .. ["", ""]
str ..    Ă
str.scan("\\w+")::group(0) .. ["", "", "", "Ă"]
str.scan("\\w+", 10)::group(0) .. ["", "", "Ă"]
str.scan("\\w+", 0, 10)::group(0) .. ["", ""]
str ..    Ă
str.match("\\w+", 0).group(0) .. 
str.match("\\w+", 6).group(0) .. 
str.match("\\w+", 12).group(0) .. 
str.match("\\w+", 12, 13).group(0) .. 
m.string .. 3.14
m.group(1) .. 3
m.group(2) .. 14
m.groups() .. ["3", "14"]
re.scan("(ba)(.)", "foobarbazfoobarbaz"):list {|m| [m.group(0), m.group(1, 2)] } .. [["bar", ["ba", "r"]], ["baz", ["ba", "z"]], ["bar", ["ba", "r"]], ["baz", ["ba", "z"]]]
sourceforge.jp
slashdot.jp
www.google.com
["hoge", "foo", "bar"]
["hoge", "foo", "bar"]
0
100
300
999
9999
["", "bbbbbb", "cccccDD", ""]
["", "bbbbbb", "cccccDD", ""]
<match:0-2>
<match:7-14,7-10>
re.match("A(a*)A", "AA").group(1) .. 
m.string .. 3.14
m.group(1) .. 3
m.group(2) .. 14
m.groups() .. ["3", "14"]
m.string .. 3.14
m.group("first") .. 3
m.group("second") .. 14
m.string .. 3.14
m.group("first") .. 3
m.group(2) .. 14
m.string .. 3.14
m.group(1) .. 3
m.group("second") .. 14
chooseif(re.match("hello", "HELLO WORLD"), "match", "not match") .. not match
chooseif(re.match(re.pattern("hello"):icase, "HELLO WORLD"), "match", "not match") .. match
m.string .. 3.14
m.group(1) .. 3
m.group(2) .. 14
m.groups() .. ["3", "14"]
m.string .. 3.14
m.group("first") .. 3
m.group("second") .. 14
m.string .. 3.14
m.group("first") .. 3
m.group(2) .. 14
m.string .. 3.14
m.group(1) .. 3
m.group("second") .. 14
chooseif(re.pattern("hello").match("HELLO WORLD"), "match", "not match") .. not match
chooseif(re.pattern("hello"):icase.match("HELLO WORLD"), "match", "not match") .. match
re.sub(",\\s*", ":", "1234, 567,    890,   123") .. 1234:567:890:123
re.sub("def\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\(\\s*\\):", "static PyObject*\\npy_\\1(void)\\n{", "def myfunc():") .. static PyObject*
py_myfunc(void)
{
dashrepl(matchobj) = { if (matchobj.group(0) == "-") { return(" ") } else { return("-") } }
re.sub("-{1,2}", dashrepl, "pro----gram-files") .. pro--gram files
re.pattern(",\\s*").sub(":", "1234, 567,    890,   123") .. 1234:567:890:123
re.pattern("def\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\(\\s*\\):").sub("static PyObject*\\npy_\\1(void)\\n{", "def myfunc():") .. static PyObject*
py_myfunc(void)
{
dashrepl(matchobj) = { if (matchobj.group(0) == "-") { return(" ") } else { return("-") } }
re.pattern("-{1,2}").sub(dashrepl, "pro----gram-files") .. pro--gram files
 sourceforge.jp slashdot.jp www.google.com
 sourceforge.jp slashdot.jp www.google.com
