I have one variable that comes from a map, I'm trying to get a specific part between square brackets
(e.g."dmfkdmfk[IWANTTHISPART]mlkm")
but it isn't working by the way I did. I'm trying as same way used here.
Original Code:
query_values = activities.map do |activity|
'(' +
"#{activity['note']}"
+')'
end
I tried:
query_values = activities.map do |activity|
'(' +
"#{activity['note'].[/#{"["}(.*?)#{"]"}/m, 1]}"
+')'
end
Error log:
syntax error, unexpected '[', expecting '('
'(' + "#{activity['note'].[/#{"["}(.*?)#{"]"}/m, 1]},""'" +')'
^
quase.rb:40: syntax error, unexpected keyword_end, expecting tSTRING_DEND
How can I go through? Many Thanks.