str = "A30-60_10000"
str.sub(/_.*/, "")
Result ↓
=> "A30-60"
str.sub(/.*_/, "")
"10000"
reference https://qiita.com/flmil/items/8cbfbf49844ddef79000
Recommended Posts