View Problem

Check if a string contains a match to a regular expression

Display "ok" if "abc 123 @#$" matches /\d+/
DiskEdit
groovy
if ('abc 123 @#$' =~ /\d+/) println 'ok'
DiskEdit
groovy 1.6.1+
if ('abc 123 @#$'.find(/\d+/)) println 'ok'

Submit a new solution for groovy
There are 15 other solutions in additional languages (clojure, cpp, csharp, erlang ...)