Loadrunner Regular Expression
I am trying to fetch the value from a dynamic boundary. source code and snippet given below.
name="pvUnitPriceInclTax242" type="text" value="30.0000" web_reg_save_param_ex("ParamName=pvUnitPriceInclTaxValue", "RegExp=name=\"pvUnitPriceInclTax[0-9]+\" type=\"text\" value=\"([0-9]+\.[0-9]+)\"", LAST);
I have checked above regular expression here and its working fine. But it gives following error while running in Loadrunner.
The "RegExp=name="pvUnitPriceInclTax[0-9]+" type="text" value="([0-9]+.[0-9]+)"" argument (number 2) is unrecognized or misplaced
since Loadrunner uses PCRE, i have no idea why its happening. Somebody please help me to solve this.
See also questions close to this topic
How to extract pattern with sed
I have tried many many times with different tools to extract a pattern from a file using unix tools, but I can't seem to get them to do what I want. So I have a file like this:
[blah] project=abc123 ON#IRUjdi2ujnq!De
And I want to capture the project name.
I've tried using grep, egrep, awk, and sed, but I haven't been able to get them to work. Here's my current attempt.
cat file | sed -n "s/project = \(.*\)/\1/p"
and here's the current output
For some reason it's considering the last 2 lines to match. I thought my regex would require a literal match on
project =but it seems this is not the case.
Can some unix wizard help me out here? Any standard unix tool is fine.
------ EDIT ------
So actually my problem was slightly different. I was actually doing
gcloud config list project | sed -n "s/project = \(.*\)/\1/p"
Sorry I thought that it wouldn't make a difference, but apparently this is the issue.
If you do this
gcloud config list project >> file
It will actually only output the the listing of your projects to the file and then it will print
Your active configuration is: [default]
to the terminal, and this is what was messing things up. If I manually write the whole output of doing the gcloud command to a file and then ran sed on that it actually worked. So it's something strange about how gcloud is outputting it's data.
Regex to include everything under root folder except for 2 folders?
I have a Wordpress blog that I want to redirect to a new non-Wordpress blog. I have a plugin called Redirection that allows me to target a source URL with regex and redirect it to a target URL.
Currently, I have it set up as this:
- Source: /.*
- Target: http://mywebsite.com
This works fine but I am now unable to access Wordpress because http://mywebsite.com/wp-admin redirects me to my new website.
What regex value should I put down as the source URL so that I target everything under root except for folders:
How to define optional suffix in regex?
I have a string as an input which may or may not end with some suffix. Let it be suffix "xyz". I want to capture everything that is before this suffix. For example:
if input is: "abc xyz", then "abc " should be captured (without suffix)
if input is just: "abc" then "abc" should be captured
My thought was that simple regex like:
will work, meaning any data following by optional xyz suffix. But in case of input: "abc xyz" the captured group is the whole input instead of "abc "
Combining Groups of Incrementing Digits with Regex
Hi StackOverflow Community!
I am writing a catch-all solution to naming conventions with course codes and combining them. A simple example of a course code looks like this: 00001
What I have currently is a set of course codes in a string. Something like this:
I am still new to using regex, but is it possible to make an expression that checks if
Each code between the delimiter is incremented by one of its previous codes. Then, it takes the first and the last of those codes, removes the middle codes, and replaces it with "-" So, for the same set of codes, I would get:
Even if the code came back looking like this: 00001_-_00003_00005_00008_-_00009, I could finagle the string after the fact to replace '_-_' with '-'.
All of the codes are already in incrementing order so it would just have to iterate through from left to right.
So far what I have (I know it's pretty bare-bones): https://regex101.com/r/Yb1gSq/2/
Anyone have any pointers? Or should I be looking for a different solution other than regex?
regex <bi> <ubi> etc but not <bbi> and yes </ubi>
I'm very close to what I need but there is something I don't understand in my regex.
I'm looking to match such kind of expressions:
<b>ffdffgfd</b> <bbi>ffdffgfd</bu> I don't want <bbi> </bui> I *do* want </bui> </ub> <iub>ffdffgfd </bu>
with this regex
but as you can see in my comments, 2 cases don't work. Edit In fact for my first problem I don't how to tell accept one character in group 2 which is not in group 1.
Maybe you could better look at regex
using back-references in a lookahead assertion
I wanted to tokenize an expression like
or(This expression is almost meaningless, but this time it does not matter). Then, considering the regular expression of the first version (
T.re0), and applied it to the test
T.test0(), and succeeded.
Next, I thought that I could rewrite the inside of
(?=...)of T.re0 using
\1.... So I rewritten T.re0 into
T.re1and applied it to the test
T.test1(). But it failed.
What is wrong?
from unittest import TestCase from re import compile as regex, X as REGEX_X def setup(): re0 = r''' ( \s* < \s* ) | ( (?:\s+|\b) or (?:\s+|\b) ) | ( .+? (?= \s* < \s* | (?:\s+|\b) or (?:\s+|\b) ) ) ''' re1 = r''' ( \s* < \s* ) | ( (?:\s+|\b) or (?:\s+|\b) ) | ( .+? (?= \1 | \2 ) ) ''' return re0, re1 class T(TestCase): re0, re1 = setup() def test0(self): self._test(self.re0) def test1(self): self._test(self.re1) def _test(self, re): re = regex(re, REGEX_X) expected = r'a < or' expected = expected.split() expected = tuple(expected) actual = re.finditer(r'a<or') actual = _pick(actual) actual = tuple(actual) self.assertEqual(expected, actual) def _pick(g): def pick_impl(groups): return next(y for y in groups if y is not None) return map(pick_impl, (y.groups() for y in g))
Loadrunner VUGen - Tru-Client - How do you upload a file?
I've recorded a script using the TruClient protocol in which part of the business process for the web-app under test requires uploading a .pdf file. To initiate the upload, you click on the "Upload file" button found on the page, which produces the Windows' filepicker. The file is selected and then uploaded to the application.
Upon playing this script back in VUGen, the script timesout at the upload file transaction. Does anyone know a workaround to this? I'm using Loadrunner VUGen 12.55.
Popup issues in loadrunner
I am working with loadrunner 12.53 using http/html protocol. My script contains a radio button, i am clicking on it and saving it and moving to the next page. This is the flow.
I am sending radio button value as 2, but in the response it is always taking as 0 value, which means it is not selecting either of the radio buttons, i have tried giving values of radio button instead of numberings but then also, in response, we are getting as 0, can anybody please suggest how to handle this?
file name or the location path does not get captured in the script when attaching a file in a Loadrunner Script
I’m doing performance scripting on a Pega application using web http protocol, there is a step to brows & attach a excel file in the user flow. But when recording, the file name or the location path does not get captured in the script. The itemdata section in the particular post request is blank. Have anyone faced the same issue & have any solutions LR version 12.02 Pega version: Pega 7