try{under=Pattern.compile(pattern,Pattern.DOTALL|Pattern.UNICODE_CHARACTER_CLASS);}// JRE.7:UNICODE_CHARACTER_CLASS; added during %w fix for en.w:A#; DATE:2015-06-10
catch(Exceptione){// NOTE: if invalid, then default to empty pattern (which should return nothing); EX:d:〆る generates [^]; DATE:2013-10-20
if(len==0)returnrslt.Init_null();// return null if no matches found; EX:w:Mount_Gambier_(volcano); DATE:2014-04-02; confirmed with en.d:民; DATE:2015-01-30
// TOMBSTONE: add 1st match only; do not add all; PAGE:en.d:действительное_причастие_настоящего_времени DATE:2017-04-23
Exec_match(" a b ","^%s*(.-)%s*$",1,"a b;");// trim; NOTE: changed from "a b" to "a b;"; DATE:2015-01-30
Exec_match(" a b ","^%s*(.-)%s*$",1,"a b");// trim; NOTE: changed back from "a b;" to "a b"; DATE:2017-04-23; changed from "a b" to "a b;"; DATE:2015-01-30
Exec_match("abcd","a",0,"a");// handle 0; note that php/lua is super-1, but some modules pass in 0; ru.w:Module:Infocards; DATE:2013-11-08
Exec_match("abcd",".",-1,"d");// -1
Exec_match("aaa","a",1,"a");// should return 1st match not many
Exec_match("aaa","(a)",1,"a;a;a");// should return all matches
Exec_match("aaa","(a)",1,"a");// should return 1st match only; PAGE:en.d:действительное_причастие_настоящего_времени DATE:2017-04-23
Exec_match("a b","%S",1,"a");// %S was returning every match instead of 1st; PAGE:en.w:Bertrand_Russell; DATE:2014-04-02
Exec_match(1,"a",1,String_.Null_mark);// Module can pass raw ints; PAGE:en.w:Budget_of_the_European_Union; DATE:2015-01-22
Exec_match("","a?",1,"");// no results with ? should return "" not nil; PAGE:en.d:民; DATE:2015-01-30