Regex return the whole line

I'm using regex to get data from a page
But when I set the code to extract a specific data, it return with the whole line
ex: cityId&cairo31=maincity
the regex code I used : cityId&(.*?)=maincity
It should return with : cairo31 only
but the result is the whole line cityId&cairo31=maincity
I don't know why? or I'm using regex in wrong way?

Your regex is valid, but WS's regex does not seem to support sub-pattern extraction. However, it does support lookbehind and lookahead assertions, so you can use those to achieve the same result. Something like:

(?<=cityId&).+(?=\=main)

2 Likes