so, you want a single input box, that takes input in that format and stores
the values in 3 separate columns?
I'd make a virtual attribute accessor
attr_accessor :street, :type => :string
def street
"Number: #{street_number} Street Name: #{street_name} Street Type:
#{street_type} Unit: #{street_unit}"
end
def street=(value)
match = value.match
/^[^\[]*\[([^\]]*)\][^\[]*\[([^\]]*)\][^\[]*\[([^\]]*)\][^\[]*\[([^\]]*)\]/
# should make sure match returned results here
street_number = match[1]
street_name = match[2]
street_type = match[3]
street_unit = match[4]
value
end
I couldn't think of a way to the regexp without the repeats and still have
the pieces back properly. I did it without using the text and just match
bracket in case you need to support multiple languages. Probably should
also never_show the 4 subcolumns.
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.