I try to learn groovy in SoapUI and now I have a problem with a regular expression in groovy.
I try build a regular expression in groovy to parse this text:
[EM6111949VA61=cfefcgjnjcidaiieodmlgfijaiknankpiodhghbagndikijiieicfhiiiojmfcfgjjkokkoilinbkkedcaafplikgjhomkhnopjhfhpjgkadalbkeenengiapjpeaiemokenfckjbeho; path=/bla/bla; secure; HttpOnly]
The result must be:
EM6111949VA61=cfefcgjnjcidaiieodmlgfijaiknankpiodhghbagndikijiieicfhiiiojmfcfgjjkokkoilinbkkedcaafplikgjhomkhnopjhfhpjgkadalbkeenengiapjpeaiemokenfckjbeho
My groovy source-code in SoapUI is:
erg='[EM6111949VA61=cfefcgjnjcidaiieodmlgfijaiknankpiodhghbagndikijiieicfhiiiojmfcfgjjkokkoilinbkkedcaafplikgjhomkhnopjhfhpjgkadalbkeenengiapjpeaiemokenfckjbeho; path=/bla/bla; secure; HttpOnly]'
def muster = /(?<=\[)[\w]+=[\w]+/
(erg ==~ muster).each {
log.info "Muster $it"
}
the log.info result is: Muster false
I try the text with the Expression::
(?<=\[)[\w]+=[\w]+ to http://www.regexe.de/
And the result is what I need,
EM6111949VA61=cfefcgjnjcidaiieodmlgfijaiknankpiodhghbagndikijiieicfhiiiojmfcfgjjkokkoilinbkkedcaafplikgjhomkhnopjhfhpjgkadalbkeenengiapjpeaiemokenfckjbeho
What is the correct Syntax in groovy
Thanks a lot for your answers
Michael