テキストと数値データの両方を含むことができる文字列が与えられました。
例:
「100 ポンド」「173 ポンドだと思います」「73 ポンド」
これらの文字列から数値データのみを抽出するクリーンな方法を探しています。
応答を削除するために現在行っていることは次のとおりです。
def stripResponse(String response) {
    if(response) {
        def toRemove = ["lbs.", "lbs", "pounds.", "pounds", " "]
        def toMod = response
        for(remove in toRemove) {
            toMod = toMod?.replaceAll(remove, "")
        }
        return toMod
    }
}