Hi there, Anybody knows how to use regex to validate street name field? I want to avoid things like "st asdkskjfls çsdfksçf". Thanks, Pedro -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I don''t think a regex can save you here. Ask yourself a higher-level question. Why are you gathering the address information, and why isn''t it optional? If it''s to send something of value to the person you''re requesting it from by postal mail, or if you''re using it to help them find something they need nearby their home, then rest assured they will enter it with care. If it''s anything less, you invite this sort of abuse, and you should either just stop asking the question, or realize that a significant percentage of entries will be "undeliverable" (to use the Post Office''s bloodless euphemism). By the way, I believe the USPS has an address checker API, IIRC, I''ve used it from PHP before, and there may be a Gem wrapper for it as well. Ditto FedEx if you''re using them for delivery. Walter On May 11, 2011, at 9:39 AM, Pedro wrote:> Hi there, > > Anybody knows how to use regex to validate street name field? I want > to avoid things like "st asdkskjfls çsdfksçf". > Thanks, > > Pedro > > -- > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails- > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com > . > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en > . >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Walter Im using address to geocoding. Do you know if exists an address check plugin or gem to do this work? Thanks Pedro On 11 maio, 10:54, Walter Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> I don''t think a regex can save you here. Ask yourself a higher-level > question. Why are you gathering the address information, and why isn''t > it optional? If it''s to send something of value to the person you''re > requesting it from by postal mail, or if you''re using it to help them > find something they need nearby their home, then rest assured they > will enter it with care. > > If it''s anything less, you invite this sort of abuse, and you should > either just stop asking the question, or realize that a significant > percentage of entries will be "undeliverable" (to use the Post > Office''s bloodless euphemism). > > By the way, I believe the USPS has an address checker API, IIRC, I''ve > used it from PHP before, and there may be a Gem wrapper for it as > well. Ditto FedEx if you''re using them for delivery. > > Walter > > On May 11, 2011, at 9:39 AM, Pedro wrote: > > > > > > > > > Hi there, > > > Anybody knows how to use regex to validate street name field? I want > > to avoid things like "st asdkskjfls çsdfksçf". > > Thanks, > > > Pedro > > > -- > > You received this message because you are subscribed to the Google > > Groups "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails- > > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > . > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en > > .-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On May 11, 2011, at 10:18 AM, Pedro wrote:> Walter > Im using address to geocoding. Do you know if exists an address check > plugin or gem to do this work? > > Thanks > > Pedro >I repeat my earlier point. If it''s not valuable enough to the user, they will spam you like this. If your geocoder reports an error, then raise it to the user, tell him or her "sorry, having trouble with that location, could you check the address again?" You may be able to find a gem that wraps the USPS database, or FedEx''s (with an API key from FedEx, and weeks of back-and-forth with their approval team). But it still gets back to the original "value to the user" question. What exactly do you give them in return for their successful entry of a real address? Do *they* think it''s valuable? Walter> > On 11 maio, 10:54, Walter Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: >> I don''t think a regex can save you here. Ask yourself a higher-level >> question. Why are you gathering the address information, and why >> isn''t >> it optional? If it''s to send something of value to the person you''re >> requesting it from by postal mail, or if you''re using it to help them >> find something they need nearby their home, then rest assured they >> will enter it with care. >> >> If it''s anything less, you invite this sort of abuse, and you should >> either just stop asking the question, or realize that a significant >> percentage of entries will be "undeliverable" (to use the Post >> Office''s bloodless euphemism). >> >> By the way, I believe the USPS has an address checker API, IIRC, I''ve >> used it from PHP before, and there may be a Gem wrapper for it as >> well. Ditto FedEx if you''re using them for delivery. >> >> Walter >> >> On May 11, 2011, at 9:39 AM, Pedro wrote: >> >> >> >> >> >> >> >>> Hi there, >> >>> Anybody knows how to use regex to validate street name field? I want >>> to avoid things like "st asdkskjfls çsdfksçf". >>> Thanks, >> >>> Pedro >> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ruby on Rails: Talk" group. >>> To post to this group, send email to rubyonrails- >>> talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >>> . >>> For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en >>> . > > -- > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails- > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com > . > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en > . >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>> Walter >> Im using address to geocoding. Do you know if exists an address check >> plugin or gem to do this work? >> >> Thanks >> >> Pedro >> > > I repeat my earlier point. If it''s not valuable enough to the user, they will spam you like this. If your geocoder reports an error, then raise it to the user, tell him or her "sorry, having trouble with that location, could you check the address again?" > > You may be able to find a gem that wraps the USPS database, or FedEx''s (with an API key from FedEx, and weeks of back-and-forth with their approval team). But it still gets back to the original "value to the user" question. What exactly do you give them in return for their successful entry of a real address? Do *they* think it''s valuable?+1 for everything Walter has said about requiring it... Also... my memory is that yes the USPS has this ability, but it''s not free (and quite expensive). Google can do it as well. Look into the geokit-rails stuff. It won''t help with sanitizing the input, but it will turn it into a lat/long pair if it can. If location isn''t super super important, just ask for their zip code. That''s certainly granular enough to do "nearby" type functionality. Good luck! -philip> Walter > >> >> On 11 maio, 10:54, Walter Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: >>> I don''t think a regex can save you here. Ask yourself a higher-level >>> question. Why are you gathering the address information, and why isn''t >>> it optional? If it''s to send something of value to the person you''re >>> requesting it from by postal mail, or if you''re using it to help them >>> find something they need nearby their home, then rest assured they >>> will enter it with care. >>> >>> If it''s anything less, you invite this sort of abuse, and you should >>> either just stop asking the question, or realize that a significant >>> percentage of entries will be "undeliverable" (to use the Post >>> Office''s bloodless euphemism). >>> >>> By the way, I believe the USPS has an address checker API, IIRC, I''ve >>> used it from PHP before, and there may be a Gem wrapper for it as >>> well. Ditto FedEx if you''re using them for delivery. >>> >>> Walter >>> >>> On May 11, 2011, at 9:39 AM, Pedro wrote: >>> >>> >>> >>> >>> >>> >>> >>>> Hi there, >>> >>>> Anybody knows how to use regex to validate street name field? I want >>>> to avoid things like "st asdkskjfls çsdfksçf". >>>> Thanks, >>> >>>> Pedro >>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Ruby on Rails: Talk" group. >>>> To post to this group, send email to rubyonrails- >>>> talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >>>> . >>>> For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en >>>> . >> >> -- >> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
+1 to everything Walter has said, as well. I haven''t thought about this a lot, but doesn''t this apply to everything in terms of user input? Doesn''t this really enter the realm of a basic guideline, principle, or law for UI? (I remember something like this being applied to database design.) Don''t make people enter data that they don''t care about. Don''t make people enter data that doesn''t affect anything. Carefully evaluate whether people really need to enter data. If people feel free to enter garbage in a field, should that data really be asked for? Aren''t there, potentially, corollaries to this? For instance, Always allow the people entering data to easily correct or remove their data. Fred On Wed, May 11, 2011 at 9:55 AM, Philip Hallstrom <philip-LSG90OXdqQE@public.gmane.org> wrote:> >> Walter > >> Im using address to geocoding. Do you know if exists an address check > >> plugin or gem to do this work? > >> > >> Thanks > >> > >> Pedro > >> > > > > I repeat my earlier point. If it''s not valuable enough to the user, they > will spam you like this. If your geocoder reports an error, then raise it to > the user, tell him or her "sorry, having trouble with that location, could > you check the address again?" > > > > You may be able to find a gem that wraps the USPS database, or FedEx''s > (with an API key from FedEx, and weeks of back-and-forth with their approval > team). But it still gets back to the original "value to the user" question. > What exactly do you give them in return for their successful entry of a real > address? Do *they* think it''s valuable? > > +1 for everything Walter has said about requiring it... > > Also... my memory is that yes the USPS has this ability, but it''s not free > (and quite expensive). Google can do it as well. Look into the > geokit-rails stuff. It won''t help with sanitizing the input, but it will > turn it into a lat/long pair if it can. > > If location isn''t super super important, just ask for their zip code. > That''s certainly granular enough to do "nearby" type functionality. > > Good luck! > > -philip > > > > > Walter > > > >> > >> On 11 maio, 10:54, Walter Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: > >>> I don''t think a regex can save you here. Ask yourself a higher-level > >>> question. Why are you gathering the address information, and why isn''t > >>> it optional? If it''s to send something of value to the person you''re > >>> requesting it from by postal mail, or if you''re using it to help them > >>> find something they need nearby their home, then rest assured they > >>> will enter it with care. > >>> > >>> If it''s anything less, you invite this sort of abuse, and you should > >>> either just stop asking the question, or realize that a significant > >>> percentage of entries will be "undeliverable" (to use the Post > >>> Office''s bloodless euphemism). > >>> > >>> By the way, I believe the USPS has an address checker API, IIRC, I''ve > >>> used it from PHP before, and there may be a Gem wrapper for it as > >>> well. Ditto FedEx if you''re using them for delivery. > >>> > >>> Walter > >>> > >>> On May 11, 2011, at 9:39 AM, Pedro wrote: > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>>> Hi there, > >>> > >>>> Anybody knows how to use regex to validate street name field? I want > >>>> to avoid things like "st asdkskjfls çsdfksçf". > >>>> Thanks, > >>> > >>>> Pedro > >>> > >>>> -- > >>>> You received this message because you are subscribed to the Google > >>>> Groups "Ruby on Rails: Talk" group. > >>>> To post to this group, send email to rubyonrails- > >>>> talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >>>> To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > >>>> . > >>>> For more options, visit this group athttp:// > groups.google.com/group/rubyonrails-talk?hl=en > >>>> . > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. > >> To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >> > > > > -- > > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Wed, May 11, 2011 at 10:26 AM, Fred Ballard <fredb001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> +1 to everything Walter has said, as well. > > I haven''t thought about this a lot, but doesn''t this apply to everything in > terms of user input? Doesn''t this really enter the realm of a basic > guideline, principle, or law for UI? (I remember something like this being > applied to database design.) > > Don''t make people enter data that they don''t care about. > > Don''t make people enter data that doesn''t affect anything. > > Carefully evaluate whether people really need to enter data. > > If people feel free to enter garbage in a field, should that data > really be asked for? > > Aren''t there, potentially, corollaries to this? For instance, Always allow > the people entering data to easily correct or remove their data. >Also, coming from one who has written address validation for credit reporting, you would not believe the complexity --- think of po boxes, boxes, railroad stops, prefixes/suffixes (w,nw,s,...), apartments, suites, rooms.... I dont remember exactly why I had to do it but it was one of those things I thanked god that I was using tdd :)> > Fred > > On Wed, May 11, 2011 at 9:55 AM, Philip Hallstrom <philip-LSG90OXdqQE@public.gmane.org> wrote: > >> >> Walter >> >> Im using address to geocoding. Do you know if exists an address check >> >> plugin or gem to do this work? >> >> >> >> Thanks >> >> >> >> Pedro >> >> >> > >> > I repeat my earlier point. If it''s not valuable enough to the user, they >> will spam you like this. If your geocoder reports an error, then raise it to >> the user, tell him or her "sorry, having trouble with that location, could >> you check the address again?" >> > >> > You may be able to find a gem that wraps the USPS database, or FedEx''s >> (with an API key from FedEx, and weeks of back-and-forth with their approval >> team). But it still gets back to the original "value to the user" question. >> What exactly do you give them in return for their successful entry of a real >> address? Do *they* think it''s valuable? >> >> +1 for everything Walter has said about requiring it... >> >> Also... my memory is that yes the USPS has this ability, but it''s not free >> (and quite expensive). Google can do it as well. Look into the >> geokit-rails stuff. It won''t help with sanitizing the input, but it will >> turn it into a lat/long pair if it can. >> >> If location isn''t super super important, just ask for their zip code. >> That''s certainly granular enough to do "nearby" type functionality. >> >> Good luck! >> >> -philip >> >> >> >> > Walter >> > >> >> >> >> On 11 maio, 10:54, Walter Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: >> >>> I don''t think a regex can save you here. Ask yourself a higher-level >> >>> question. Why are you gathering the address information, and why isn''t >> >>> it optional? If it''s to send something of value to the person you''re >> >>> requesting it from by postal mail, or if you''re using it to help them >> >>> find something they need nearby their home, then rest assured they >> >>> will enter it with care. >> >>> >> >>> If it''s anything less, you invite this sort of abuse, and you should >> >>> either just stop asking the question, or realize that a significant >> >>> percentage of entries will be "undeliverable" (to use the Post >> >>> Office''s bloodless euphemism). >> >>> >> >>> By the way, I believe the USPS has an address checker API, IIRC, I''ve >> >>> used it from PHP before, and there may be a Gem wrapper for it as >> >>> well. Ditto FedEx if you''re using them for delivery. >> >>> >> >>> Walter >> >>> >> >>> On May 11, 2011, at 9:39 AM, Pedro wrote: >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>>> Hi there, >> >>> >> >>>> Anybody knows how to use regex to validate street name field? I want >> >>>> to avoid things like "st asdkskjfls çsdfksçf". >> >>>> Thanks, >> >>> >> >>>> Pedro >> >>> >> >>>> -- >> >>>> You received this message because you are subscribed to the Google >> >>>> Groups "Ruby on Rails: Talk" group. >> >>>> To post to this group, send email to rubyonrails- >> >>>> talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >>>> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >> >>>> . >> >>>> For more options, visit this group athttp:// >> groups.google.com/group/rubyonrails-talk?hl=en >> >>>> . >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> Groups "Ruby on Rails: Talk" group. >> >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm >> . >> >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups "Ruby on Rails: Talk" group. >> > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. >> > To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.