I am trying to learn groovy in SoapUI and now I have a regex problem in groovy.
I am trying to create a regex in groovy to parse this text:
[EM6111949VA61 = cfefcgjnjcidaiieodmlgfijaiknankpiodhghbagndikijiieicfhiiiojmfcfgjjkokkoilinbkkedcaafplikgjhomkhnopjhfhpjgkadalbkeenengiapjpeaiemokenfck; Path = / li / l; security; HttpOnly]
The result should be:
EM6111949VA61 = cfefcgjnjcidaiieodmlgfijaiknankpiodhghbagndikijiieicfhiiiojmfcfgjjkokkoilinbkkedcaafplikgjhomkhnopjhfhpjgkadalbkeenengiapjpeaiemokenfckjbe
My groovy source code in SoapUI:
erg='[EM6111949VA61=cfefcgjnjcidaiieodmlgfijaiknankpiodhghbagndikijiieicfhiiiojmfcfgjjkokkoilinbkkedcaafplikgjhomkhnopjhfhpjgkadalbkeenengiapjpeaiemokenfckjbeho; path=/bla/bla; secure; HttpOnly]'
def muster = /(?<=\[)[\w]+=[\w]+/
(erg ==~ muster).each {
log.info "Muster $it"
}
Result of log.info: Muster false
I try text using Expression :: expression
(?<=\[)[\w]+=[\w]+ to http:
And the result is what I need
EM6111949VA61 = cfefcgjnjcidaiieodmlgfijaiknankpiodhghbagndikijiieicfhiiiojmfcfgjjkokkoilinbkkedcaafplikgjhomkhnopjhfhpjgkadalbkeenengiapjpeaiemokenfckjbe
What is the correct syntax in groovy
Thanks so much for your answers.
Michael