I have an array as below:
arr = [
nil,
6,
"17 to 23 ||'.'||24 to 25 (add a decimal at 10th place)",
nil,
nil,
"37 to 51 ||'.'||52 to 53 (add a decimal at 100th place)",
nil
]
I want to convert this array into the following:
arr = [
nil,
6,
"10th",
nil,
nil,
"100th",
nil
]
i.e from the string "17 to 23 ||'.'||24 to 25 (add a decimal at 10th place)", I need the digits mentioned in the bracket.
I tried the following code, but its not working:
arr.map! {|e| e[/^.*?add.*?(\d+)th.*?$/]}
...th? What about...2ndand...3rd?thonly