سؤال

I am using regex to extract a value from a variable. The output comes in this format:

[["\"XXX.YYY\""]]

So, I use flatten & it gives me this output:

["\"XXX.YYY\""]

How can I extract only XXX.YYY from this?

هل كانت مفيدة؟

المحلول

Try:

a = [["\"XXX.YYY\""]]
puts a.flatten[0].gsub('"','')
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top