如何在groovy中抓取子字符串?



我可以知道如何提取子字符串';10111"源自string "some infor [1:5] 10111"在groovy中?下面的代码是我写的,有没有更好的方法来做到这一点?

parentString = "some infor [1:5] 10111"
String childString = parentString
println childString.substring(16)
def parentString = "some infor [1:5] 10111"
def childString  = parentString.replaceAll( /.*[d+:d+]s*(.*)/ , '$1' )
println childString

about regex: https://regex101.com/r/MWVdGX/1

最新更新