re = /nurhuda/m
str = '<script type="text/javascript">
function validasi_input(form){
pola_username=/^[a-z]{5,7}$/;
if (!pola_username.test(form.username.value)){
alert (\'Username minimal 5-7 karakter dan hanya boleh Huruf kecil!\');
form.username.focus();
return false;
}
return (true);
}
function password(nilai, pesan) {
var pass = /^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{9})+$/;
if(nilai.value.match(pass)) {
return true;
}
else {
alert(password merupakan kombinasi huruf kecil, huruf besar, angka dan simbol "@" dan harus 9 karakter);
nilai.focus();
return false;
}
}
</script>'
# 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