Match values from Drop Down

Hi All,
i have a Scenario, wherein I am getting list of Drop Down values
from a select box. I need to validate whether particualr string or value
exists in the drop down.
example:

collect = get_select_options(“dropdownElement”)
puts collect
Output of collect would be like this with all drop down values
{Nov 19 '11,Dec 17 '11,Oct 28 '11w,Jan 21 '12,Feb 18 '12,Mar 17 '12,Dec
22 '12,Dec 21 '13}

Now I want to check for value date with ‘w’ in that, in the above case
its “Oct 28 '11w”

collect.each do |line|
if line == “Oct 28 '11w” – (i don’t want to hard code date like
this)
do code
else
pattern doesn’t exists.
end

How do i solve this issue, Can i directly match value with regular
expresssion?
please let me know if i am clear with my explanation.

Cheers

Can i directly match value with regular
expresssion?

definitely… check out these links and see if they help:

  • j