actually, it's a jdk design problem, and somebody has fired a bug in
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4675952
when a regex includes a pattern like "(a|b)*", the StackOverflowError
will occur.
however, since sun doesn't to consider to fix it, i have changed the
pattern as
:(DECLARE\s*@object\s*int\s*--declare\s*the\s*object\s*variable)([\w\W]*)(CAST\(@error\s*as\s*nvarchar\(200\)\))[\r\n\s]*(END);and
it works
(1) i want to match the "DECLARE @object int
--declare the object variable.
.................................
.................................
CAST @error as nvarchar(200))
END
"
(2) it's my fault, i have though that \s cannot match \r and \n
(3) Maybe it's ok to use dot to match all chars.
(4) i just want to match any char groups, and now i alternate it to
(\w\W)*