re = /^[\wàáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð']{6,20}$/m
str = 'Válidas
AaaaaaaaBCCcc654_qq
1111s123AaBCcc654_qq
____ds4___xx
12345_123
-Inválidas.
asdmkk45hjsiwehsnasp21
12345-123 (tem hífen)
asdkdn 092834sdfdf (tem espaco em branco)
$123.0 (tem "$" e ".")'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html