> It will be really helpful if someone could explain why two "\" is needed? This is a guess - i havent verified. but you usually need as many backslashes as the number of systems for which this is a special character. So \ is a special character to Jmeter but $ is a special character for regex's So what you really want \$ to be sent to the regex , you need to escape \ for Jmeter(since it will process the string first) => you need \\$ which jmeter will parse and send to the regex as \$
regards deepak On Mon, Feb 13, 2012 at 10:36 PM, vineeth <[email protected]>wrote: > Hi All > > > > I encountered a rather strange experience while implementing "Regular > Expression Extractor". > > > > I needed to extract "0" from the "<option value="0">" in the "<select > name="ctl00$ContentPlaceHolder1$ddlDivision" > id="ctl00_ContentPlaceHolder1_ddlDivision" tabindex="6" > class="clsESDropDownNormal">\r\n <option value="0">-Select-</option>" > > > > Here I was passing the "-Select-" from a CSV file. So I replaced "-Select-" > with "${Param_ddlDivision}" and escaped "$" (\$) in the two occurrences. > > > > Now the Regular Expression is: > > > > <select name="ctl00\$ContentPlaceHolder1\$ddlDivision" > id="ctl00_ContentPlaceHolder1_ddlDivision" tabindex="6" > class="clsESDropDownNormal">\r\n <option > value="(.+)">${Param_ddlDivision}</option> > > > > But this did not fetch me the value "0". Then after many trial and error > efforts I found out that for escaping the "$" I had to use two "\". > > > > Now the Regular Expression is: > > > > <select name="ctl00\\$ContentPlaceHolder1\\$ddlDivision" > id="ctl00_ContentPlaceHolder1_ddlDivision" tabindex="6" > class="clsESDropDownNormal">\r\n <option > value="(.+)">${Param_ddlDivision}</option> > > > > This happens when I am parameterizing the "-Select-" (using > "${Param_ddlDivision}" instead of "-Select-"). If "-Select-" is used > directly, only one "\" is neededfor "$". > > > > It will be really helpful if someone could explain why two "\" is needed? > While Googling I read after parsing "\\" is equivalent to an escaped "\"!!! > I got the solution for my RegEx. But I am totally confused about this two > "\". > > And is there any other scenario where this particular situation has > occurred > to anyone? > > > > Regards > > VS > > > -- > View this message in context: > http://jmeter.512774.n5.nabble.com/Regular-expression-with-escape-characters-and-Jmeter-variable-tp5481641p5481641.html > Sent from the JMeter - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
