jhcovington
13 years agoNew Contributor
User Variables within Regular Expressions?
I am attempting to create a new data selector item that will capture a value returned in a http response. The page returns a list of users, including one that was created on an earlier page in the test. Later in the test, the unique ID assigned by the database to the new user will be required. So my regular expression pattern used to match the new item needs to include variable information unique to that user (e.g. last name, first name, ssn, etc.). Is there a way to embed a user variable within the regular expression pattern?
Here is a snippet of the html response that I will parse:
<tr id='336'>
<td><pre style='margin-botton: 0px">Smith</pre></td>
<td><pre style='margin-botton: 0px">John</pre></td>
</tr>
<tr id='337'>
<td><pre style='margin-botton: 0px">Jones</pre></td>
<td><pre style='margin-botton: 0px">Robert</pre></td>
</tr>
So, assuming that user 336 was created earlier by supplying user variables with @LastName=Smith and @FirstName=John, how do I ensure that I get @UserID=336 for later use in the test script?
Here is a snippet of the html response that I will parse:
<tr id='336'>
<td><pre style='margin-botton: 0px">Smith</pre></td>
<td><pre style='margin-botton: 0px">John</pre></td>
</tr>
<tr id='337'>
<td><pre style='margin-botton: 0px">Jones</pre></td>
<td><pre style='margin-botton: 0px">Robert</pre></td>
</tr>
So, assuming that user 336 was created earlier by supplying user variables with @LastName=Smith and @FirstName=John, how do I ensure that I get @UserID=336 for later use in the test script?