Pike v8.1 release 6

Method Regexp.PCRE.Plain()->matchall()


Method matchall

this_program matchall(string subject, function(array(string)|void, array(int)|void:mixed|void) callback)

Description

Will give a callback for each match in a subject. Called arguments will be matching patterns and subpatterns in an array and as second argument the exec result array.

returns called object

example:

> Regexp.PCRE("b(a*)([^-\1234]*)(\1234*)m")
    ->matchall("abam-boom-fooabado\1234m",
               lambda(mixed s) { werror("%O\n",s); return "gurka"; });
({ /* 4 elements */
    "bam",
    "a",
    "",
    ""
})
({ /* 4 elements */
    "boom",
    "",
    "oo",
    ""
})
({ /* 4 elements */
    "bado\1234m",
    "a",
    "do",
    "\1234"
})
Result: Regexp.PCRE.StudiedWidestring("b(a*)([^-Ê\234]*)(Ê\234*)m")