Adam Akhtar wrote:
> the reg exp. looks good but when i try to apply it to help me romove 
> duplicates from a list it doesnt seem to work
> 
> list = %w{adam Adam bobby Bobby wild wILd}
> list.sort
> list.each_index do |x|
>   list.delete_at(x) if (/list[x]/i =~ list[x+1]) 

here you're literally searching for the text "list[x]", not the value of 
that expression. You need to use interpolation to place the value of 
that variable into the regular expression. Use #{expr}, like you would 
in a string:

list.delete_at(x) if ( /#{list[x]}/i =~ list[x+1])

If your strings might contain punctuation characters, you should also 
look into Regexp.escape to ensure these are dealt with safely.

alex