문제

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