groovy中从另一个字符串提取子字符串

groovy中从另一个字符串提取子字符串,groovy,Groovy,我有一个字符串: pRoiGroup="[com.testing.Location#533bfa78d3f9645043e4eb25]" 我想从pRoiGrop获取字符串“533bfa78d3f9645043e4eb25”。我如何才能做到这一点?或: String result = pRoiGroup - "[com.testing.Location#" - "]" def result= pRoiGroup.split("#")[1][0..-2] def result = pRoiGr

我有一个字符串:

pRoiGroup="[com.testing.Location#533bfa78d3f9645043e4eb25]"
我想从
pRoiGrop
获取字符串
“533bfa78d3f9645043e4eb25”
。我如何才能做到这一点?

或:

String result = pRoiGroup - "[com.testing.Location#" - "]"
def result= pRoiGroup.split("#")[1][0..-2]
def result = pRoiGroup.find( /#([a-f0-9]*)]/ ) { it[ 1 ] }
pRoiGroup[++pRoiGroup.indexOf(/#/)..-2] //No list involved