Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.6.5, 1.7-beta-2
-
Component/s: regular expressions
-
Labels:None
-
Number of attachments :
Description
Issue reported groovy-user forum: http://www.nabble.com/Regular-Expression-Evaluates-Null-As-True--to25223536.html
/ * Returns true */
println null ==~ /[^0-9]+/
/ * Returns false */
println null ==~ /[0-9]+/
In both the cases, it should probably just throw NPE.
Fixed. Pattern check against null now throws NPE and is consistent with Java.