Question

Is there a shorter way of representing the following bit of code using RegEx -

survey=fa3773ea26e64b7c8715fba9785b2486&plan=010">Survey X</a>\r\n
\t\t\t\t\t\t\t\t\t\r\n
\t\t\t\t\t\t\t\t\t\r\n
\t\t\t\t\t\t\t\t\r\n
\t\t\t\t\t\t\t</td>\r\n
\t\t\t\t\t\t\t<td nowrap>&nbsp;READY FOR SUBMISSION

I have tried

survey=(.*?)&plan(.*?)\n(.*?)\n(.*?)\n(.*?)\n(.*?)\n(.*?);READY FOR SUBMISSION

While this has worked, I wanted to shorten the expression or make it more dynamic to make it capture any number of newline characters.

The bigger picture here is to search a web page for this pattern and capture the 'ready for submission' survey id using the 1st capture group. I am using the LoadRunner tool where we use C code.

Thank you.

EDITORS NOTE: dot-matches-all is not an option.

Was it helpful?

Solution

How about this?

survey=([a-z\d]+)&plan(?:.|[\t\r\n])*?READY FOR SUBMISSION

Regular expression visualization

Debuggex Demo

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top