Feeds:
Posts
Comments

Archive for April, 2008

I was working with struts validators and need to test a phone number to be digits and starts with a leading 00, I wanna share it here

^00+\d{9,17}$
below is a ruby code snippet:
phone_no=”009621111111″
if phone_no =~ /^00+\d{0,9}$/

puts “match”

else
puts “No match”
end

a quick explain is
^ start from the beginning of the string
+\d{9,17} should include digits with at [...]

Read Full Post »